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

Unified Diff: ppapi/proxy/ppb_message_loop_proxy.cc

Issue 11740016: PPAPI: Fix destructor ordering problem for main-thread message loop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, loop is sometimes NULL Created 7 years, 12 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 | « ppapi/proxy/plugin_globals.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_message_loop_proxy.cc
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index a40fb4d1aad0e9d23d6659f996635b6f7e2d58fa..c0e9ae174da68d63a333206b30a9e62698c864c6 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -45,14 +45,12 @@ MessageLoopResource::MessageLoopResource(ForMainThread for_main_thread)
// This must be called only once, so the slot must be empty.
CHECK(!PluginGlobals::Get()->msg_loop_slot());
- base::ThreadLocalStorage::Slot* slot =
- new base::ThreadLocalStorage::Slot(&ReleaseMessageLoop);
+ // We don't add a reference for TLS here, so we don't release it. Instead,
+ // this loop is owned by PluginGlobals. Contrast with AttachToCurrentThread
+ // where we register ReleaseMessageLoop with TLS and call AddRef.
+ base::ThreadLocalStorage::Slot* slot = new base::ThreadLocalStorage::Slot();
PluginGlobals::Get()->set_msg_loop_slot(slot);
- // Take a ref to the MessageLoop on behalf of the TLS. Note that this is an
- // internal ref and not a plugin ref so the plugin can't accidentally
- // release it. This is released by ReleaseMessageLoop().
- AddRef();
slot->Set(this);
loop_proxy_ = base::MessageLoopProxy::current();
« no previous file with comments | « ppapi/proxy/plugin_globals.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698