Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2394)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1647443002: Delay destructing ChildDiscardableSharedMemoryManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 00fe36b54b8fd85a29196a284e7877ac762f7f61..880180111f94da26ddac98d0a3112e543ef8ce1e 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -965,15 +965,28 @@ void RenderThreadImpl::Shutdown() {
// Shut down the message loop and the renderer scheduler before shutting down
// Blink. This prevents a scenario where a pending task in the message loop
// accesses Blink objects after Blink shuts down.
- // This must be at the very end of the shutdown sequence. You must not touch
- // the message loop after this.
renderer_scheduler_->Shutdown();
- main_message_loop_.reset();
+ if (main_message_loop_)
+ main_message_loop_->RunUntilIdle();
+
if (blink_platform_impl_) {
blink_platform_impl_->Shutdown();
+ // This must be at the very end of the shutdown sequence.
+ // blink::shutdown() must be called after all strong references from
+ // Chromium to Blink are cleared.
blink::shutdown();
}
+ // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown
+ // is complete, because blink::shutdown destructs Blink Resources and they
+ // may try to unlock their underlying discardable memory.
+ ChildThreadImpl::ShutdownDiscardableSharedMemoryManager();
+
+ // The message loop must be cleared after shutting down
+ // the DiscardableSharedMemoryManager, which needs to send messages
+ // to the browser process.
+ main_message_loop_.reset();
+
lazy_tls.Pointer()->Set(NULL);
}
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698