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(); |