summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkouhei <kouhei@chromium.org>2015-06-15 17:01:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-16 00:01:56 +0000
commit0d8f7a40d7a7e5f6ed073bced3f2d83b6280bc0f (patch)
tree0c75bfc35c032c232c2c51a9a0ddd030636909bb
parentafc2c1cb34daef6366349037a878be7a554b9dc6 (diff)
downloadchromium_src-0d8f7a40d7a7e5f6ed073bced3f2d83b6280bc0f.zip
chromium_src-0d8f7a40d7a7e5f6ed073bced3f2d83b6280bc0f.tar.gz
chromium_src-0d8f7a40d7a7e5f6ed073bced3f2d83b6280bc0f.tar.bz2
[Reland] Destroy ContentWatcher on renderer process shutdown
In addition to the fix below, the CL now also ensure ChromeRenderViewTest to flush pending tasks before calling OnRenderProcessShutdown. This is to avoid blink tasks to run after OnRenderProcessShutdown callback is called. --- Before this CL, extensions::Dispatcher held ContentWatcher even after Blink shutdown. This caused problems with object lifetimes. ContentWatcher "has-a" WebString, which is only valid before Blink shutdown, as StringImpl held by WebString is allocated on partitionAlloc, which backing is bulk-freed on Blink shutdown. This CL fixes the issue by explicitly releasing ContentWatcher when extensions::Dispatcher notices that Blink is about to be shutdown from OnRendererProcessShutdown call. BUG=488461 Review URL: https://codereview.chromium.org/1184913003 Cr-Commit-Position: refs/heads/master@{#334500}
-rw-r--r--chrome/test/base/chrome_render_view_test.cc2
-rw-r--r--extensions/renderer/dispatcher.cc1
2 files changed, 3 insertions, 0 deletions
diff --git a/chrome/test/base/chrome_render_view_test.cc b/chrome/test/base/chrome_render_view_test.cc
index 82e0452..95a9d0c 100644
--- a/chrome/test/base/chrome_render_view_test.cc
+++ b/chrome/test/base/chrome_render_view_test.cc
@@ -5,6 +5,7 @@
#include "chrome/test/base/chrome_render_view_test.h"
#include "base/debug/leak_annotations.h"
+#include "base/run_loop.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/render_messages.h"
@@ -107,6 +108,7 @@ void ChromeRenderViewTest::SetUp() {
}
void ChromeRenderViewTest::TearDown() {
+ base::RunLoop().RunUntilIdle();
#if defined(ENABLE_EXTENSIONS)
ChromeContentRendererClient* client =
static_cast<ChromeContentRendererClient*>(content_renderer_client_.get());
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 17c6dbe..b5b5937 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -788,6 +788,7 @@ void Dispatcher::IdleNotification() {
void Dispatcher::OnRenderProcessShutdown() {
v8_schema_registry_.reset();
forced_idle_timer_.reset();
+ content_watcher_.reset();
}
void Dispatcher::OnActivateExtension(const std::string& extension_id) {