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

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

Issue 938843002: PPAPI: Don't use MessageLoop::current in the plugin process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/resource_tracker.h" 5 #include "ppapi/shared_impl/resource_tracker.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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ppapi/shared_impl/callback_tracker.h" 10 #include "ppapi/shared_impl/callback_tracker.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 LastPluginRefWasDeleted(i->second.first); 83 LastPluginRefWasDeleted(i->second.first);
84 84
85 // When we go from 1 to 0 plugin ref count, free the additional "real" ref 85 // When we go from 1 to 0 plugin ref count, free the additional "real" ref
86 // on its behalf. THIS WILL MOST LIKELY RELEASE THE OBJECT AND REMOVE IT 86 // on its behalf. THIS WILL MOST LIKELY RELEASE THE OBJECT AND REMOVE IT
87 // FROM OUR LIST. 87 // FROM OUR LIST.
88 i->second.first->Release(); 88 i->second.first->Release();
89 } 89 }
90 } 90 }
91 91
92 void ResourceTracker::ReleaseResourceSoon(PP_Resource res) { 92 void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
93 base::MessageLoop::current()->PostNonNestableTask( 93 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostNonNestableTask(
94 FROM_HERE, 94 FROM_HERE,
95 RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource, 95 RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
96 weak_ptr_factory_.GetWeakPtr(), 96 weak_ptr_factory_.GetWeakPtr(),
97 res))); 97 res)));
98 } 98 }
99 99
100 void ResourceTracker::DidCreateInstance(PP_Instance instance) { 100 void ResourceTracker::DidCreateInstance(PP_Instance instance) {
101 CheckThreadingPreconditions(); 101 CheckThreadingPreconditions();
102 // Due to the infrastructure of some tests, the instance is registered 102 // Due to the infrastructure of some tests, the instance is registered
103 // twice in a few cases. It would be nice not to do that and assert here 103 // twice in a few cases. It would be nice not to do that and assert here
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (res == 0) 261 if (res == 0)
262 return true; 262 return true;
263 263
264 // Skipping the type bits, the least significant bit of |res| should be the 264 // Skipping the type bits, the least significant bit of |res| should be the
265 // same as that of |last_resource_value_|. 265 // same as that of |last_resource_value_|.
266 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); 266 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1);
267 #endif 267 #endif
268 } 268 }
269 269
270 } // namespace ppapi 270 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698