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

Side by Side Diff: ppapi/proxy/ppb_core_proxy.cc

Issue 19492014: PPAPI: Purposely leak ProxyLock, fix shutdown race (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the destructor lock [sometimes] Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_core_proxy.h" 5 #include "ppapi/proxy/ppb_core_proxy.h"
6 6
7 #include <stdlib.h> // For malloc 7 #include <stdlib.h> // For malloc
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 int32_t result) { 55 int32_t result) {
56 DCHECK(callback.func); 56 DCHECK(callback.func);
57 #if defined(OS_NACL) 57 #if defined(OS_NACL)
58 // Some NaCl apps pass a negative delay, so we just sanitize to 0, to run as 58 // Some NaCl apps pass a negative delay, so we just sanitize to 0, to run as
59 // soon as possible. MessageLoop checks that the delay is non-negative. 59 // soon as possible. MessageLoop checks that the delay is non-negative.
60 if (delay_in_ms < 0) 60 if (delay_in_ms < 0)
61 delay_in_ms = 0; 61 delay_in_ms = 0;
62 #endif 62 #endif
63 if (!callback.func) 63 if (!callback.func)
64 return; 64 return;
65
66 ProxyAutoLock lock;
65 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask( 67 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
66 FROM_HERE, 68 FROM_HERE,
67 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), 69 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)),
68 base::TimeDelta::FromMilliseconds(delay_in_ms)); 70 base::TimeDelta::FromMilliseconds(delay_in_ms));
69 } 71 }
70 72
71 PP_Bool IsMainThread() { 73 PP_Bool IsMainThread() {
72 return PP_FromBool(PpapiGlobals::Get()-> 74 return PP_FromBool(PpapiGlobals::Get()->
73 GetMainThreadMessageLoop()->BelongsToCurrentThread()); 75 GetMainThreadMessageLoop()->BelongsToCurrentThread());
74 } 76 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ppb_core_impl_->AddRefResource(resource.host_resource()); 123 ppb_core_impl_->AddRefResource(resource.host_resource());
122 } 124 }
123 125
124 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { 126 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) {
125 ppb_core_impl_->ReleaseResource(resource.host_resource()); 127 ppb_core_impl_->ReleaseResource(resource.host_resource());
126 } 128 }
127 #endif // !defined(OS_NACL) 129 #endif // !defined(OS_NACL)
128 130
129 } // namespace proxy 131 } // namespace proxy
130 } // namespace ppapi 132 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698