summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 21:28:51 +0000
committerdglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 21:28:51 +0000
commit991cf3c582cf9c8c4ee877349e1cd35ac2b838e9 (patch)
tree688590b7eda16786d4c915baeef7a68b05b22e9a /chrome/browser
parentd59baf73fcb717fab2bbab2d9851bc9da3d5745c (diff)
downloadchromium_src-991cf3c582cf9c8c4ee877349e1cd35ac2b838e9.zip
chromium_src-991cf3c582cf9c8c4ee877349e1cd35ac2b838e9.tar.gz
chromium_src-991cf3c582cf9c8c4ee877349e1cd35ac2b838e9.tar.bz2
Ensure that we never call into WebCore::Page static methods when Page constructor hasn't been called.
This is a top crash for Mac right now. The crash occurs because the static table of all pages in the renderer is initialized in WebCore:: Page constructor, and if we attempt to access this table before the Page was created (i.e. before WebView::Create is called), we get into a crashy situation. I am really not sure how to reproduce this, but I can defend against the situation. BUG=17555 R=darin TEST=unable to repro, speculative fix. Review URL: http://codereview.chromium.org/159887 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc9
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h4
-rw-r--r--chrome/browser/renderer_host/mock_render_process_host.cc3
-rw-r--r--chrome/browser/renderer_host/mock_render_process_host.h1
-rw-r--r--chrome/browser/renderer_host/render_process_host.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc1
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc1
-rw-r--r--chrome/browser/visitedlink_unittest.cc1
8 files changed, 22 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index da11307..1192996 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -196,6 +196,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
: RenderProcessHost(profile),
visible_widgets_(0),
backgrounded_(true),
+ view_created_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_(
base::TimeDelta::FromSeconds(5),
this, &BrowserRenderProcessHost::ClearTransportDIBCache)),
@@ -522,11 +523,17 @@ void BrowserRenderProcessHost::ReceivedBadMessage(uint16 msg_type) {
BadMessageTerminateProcess(msg_type, process_.handle());
}
+void BrowserRenderProcessHost::ViewCreated() {
+ view_created_ = true;
+ visited_link_updater_->Update(this);
+}
+
void BrowserRenderProcessHost::WidgetRestored() {
// Verify we were properly backgrounded.
DCHECK_EQ(backgrounded_, (visible_widgets_ == 0));
visible_widgets_++;
- visited_link_updater_->Update(this);
+ if (view_created_)
+ visited_link_updater_->Update(this);
SetBackgrounded(false);
}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 63fb849..98a3d09 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -64,6 +64,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
virtual void ReceivedBadMessage(uint16 msg_type);
virtual void WidgetRestored();
virtual void WidgetHidden();
+ virtual void ViewCreated();
virtual void AddWord(const std::wstring& word);
virtual void AddVisitedLinks(const VisitedLinkCommon::Fingerprints& links);
virtual void ResetVisitedLinks();
@@ -135,6 +136,9 @@ class BrowserRenderProcessHost : public RenderProcessHost,
// Does this process have backgrounded priority.
bool backgrounded_;
+ // Is true only when the process had a render view created.
+ bool view_created_;
+
// Used to allow a RenderWidgetHost to intercept various messages on the
// IO thread.
scoped_refptr<RenderWidgetHelper> widget_helper_;
diff --git a/chrome/browser/renderer_host/mock_render_process_host.cc b/chrome/browser/renderer_host/mock_render_process_host.cc
index a32ebed..1dadafd 100644
--- a/chrome/browser/renderer_host/mock_render_process_host.cc
+++ b/chrome/browser/renderer_host/mock_render_process_host.cc
@@ -49,6 +49,9 @@ void MockRenderProcessHost::WidgetRestored() {
void MockRenderProcessHost::WidgetHidden() {
}
+void MockRenderProcessHost::ViewCreated() {
+}
+
void MockRenderProcessHost::AddWord(const std::wstring& word) {
}
diff --git a/chrome/browser/renderer_host/mock_render_process_host.h b/chrome/browser/renderer_host/mock_render_process_host.h
index d8b04e6..6d24cf6 100644
--- a/chrome/browser/renderer_host/mock_render_process_host.h
+++ b/chrome/browser/renderer_host/mock_render_process_host.h
@@ -40,6 +40,7 @@ class MockRenderProcessHost : public RenderProcessHost {
virtual void ReceivedBadMessage(uint16 msg_type);
virtual void WidgetRestored();
virtual void WidgetHidden();
+ virtual void ViewCreated();
virtual void AddWord(const std::wstring& word);
virtual void AddVisitedLinks(
const VisitedLinkCommon::Fingerprints& visited_links);
diff --git a/chrome/browser/renderer_host/render_process_host.h b/chrome/browser/renderer_host/render_process_host.h
index ec5d198..1653fcb 100644
--- a/chrome/browser/renderer_host/render_process_host.h
+++ b/chrome/browser/renderer_host/render_process_host.h
@@ -144,6 +144,9 @@ class RenderProcessHost : public IPC::Channel::Sender,
virtual void WidgetRestored() = 0;
virtual void WidgetHidden() = 0;
+ // Called when RenderView is created by a listener.
+ virtual void ViewCreated() = 0;
+
// Add a word in the spellchecker.
virtual void AddWord(const std::wstring& word) = 0;
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index ae1f1c8..b94d72b 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -226,6 +226,7 @@ bool RenderViewHost::CreateRenderView() {
// Let our delegate know that we created a RenderView.
delegate_->RenderViewCreated(this);
+ process()->ViewCreated();
return true;
}
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc
index b527eae..3fb5f67 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.cc
+++ b/chrome/browser/renderer_host/test/test_render_view_host.cc
@@ -32,6 +32,7 @@ TestRenderViewHost::~TestRenderViewHost() {
bool TestRenderViewHost::CreateRenderView() {
DCHECK(!render_view_created_);
render_view_created_ = true;
+ process()->ViewCreated();
return true;
}
diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc
index 16ee644..d6735ae 100644
--- a/chrome/browser/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink_unittest.cc
@@ -565,6 +565,7 @@ class VisitedLinkEventsTest : public RenderViewHostTestHarness {
rvh_factory_.set_render_process_host_factory(&vc_rph_factory_);
profile_.reset(new VisitCountingProfile(event_listener_.get()));
RenderViewHostTestHarness::SetUp();
+ rvh()->CreateRenderView();
}
VisitCountingProfile* profile() const {