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

Side by Side Diff: ppapi/shared_impl/tracked_callback.cc

Issue 19492014: PPAPI: Purposely leak ProxyLock, fix shutdown race (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test cleanup Created 7 years, 4 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/shared_impl/tracked_callback.h" 5 #include "ppapi/shared_impl/tracked_callback.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // The Enter class should handle checking this for us. 47 // The Enter class should handle checking this for us.
48 48
49 // TODO(dmichael): Add tracking at the instance level, for callbacks that only 49 // TODO(dmichael): Add tracking at the instance level, for callbacks that only
50 // have an instance (e.g. for MouseLock). 50 // have an instance (e.g. for MouseLock).
51 if (resource) { 51 if (resource) {
52 tracker_ = PpapiGlobals::Get()->GetCallbackTrackerForInstance( 52 tracker_ = PpapiGlobals::Get()->GetCallbackTrackerForInstance(
53 resource->pp_instance()); 53 resource->pp_instance());
54 tracker_->Add(make_scoped_refptr(this)); 54 tracker_->Add(make_scoped_refptr(this));
55 } 55 }
56 56
57 base::Lock* proxy_lock = PpapiGlobals::Get()->GetProxyLock(); 57 base::Lock* proxy_lock = ProxyLock::Get();
58 if (proxy_lock) { 58 if (proxy_lock) {
59 // If the proxy_lock is valid, we're running out-of-process, and locking 59 // If the proxy_lock is valid, we're running out-of-process, and locking
60 // is enabled. 60 // is enabled.
61 if (is_blocking()) { 61 if (is_blocking()) {
62 // This is a blocking completion callback, so we will need a condition 62 // This is a blocking completion callback, so we will need a condition
63 // variable for blocking & signalling the calling thread. 63 // variable for blocking & signalling the calling thread.
64 operation_completed_condvar_.reset( 64 operation_completed_condvar_.reset(
65 new base::ConditionVariable(proxy_lock)); 65 new base::ConditionVariable(proxy_lock));
66 } else { 66 } else {
67 // It's a non-blocking callback, so we should have a MessageLoopResource 67 // It's a non-blocking callback, so we should have a MessageLoopResource
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // until we're done. 203 // until we're done.
204 scoped_refptr<TrackedCallback> thiz = this; 204 scoped_refptr<TrackedCallback> thiz = this;
205 completed_ = true; 205 completed_ = true;
206 // We may not have a valid resource, in which case we're not in the tracker. 206 // We may not have a valid resource, in which case we're not in the tracker.
207 if (resource_id_) 207 if (resource_id_)
208 tracker_->Remove(thiz); 208 tracker_->Remove(thiz);
209 tracker_ = NULL; 209 tracker_ = NULL;
210 } 210 }
211 211
212 } // namespace ppapi 212 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698