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

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

Issue 14273043: ppapi: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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
« no previous file with comments | « ppapi/proxy/proxy_completion_callback_factory.h ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | 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.h" 9 #include "base/message_loop.h"
10 #include "ppapi/shared_impl/callback_tracker.h" 10 #include "ppapi/shared_impl/callback_tracker.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 LastPluginRefWasDeleted(i->second.first); 79 LastPluginRefWasDeleted(i->second.first);
80 80
81 // When we go from 1 to 0 plugin ref count, free the additional "real" ref 81 // When we go from 1 to 0 plugin ref count, free the additional "real" ref
82 // on its behalf. THIS WILL MOST LIKELY RELEASE THE OBJECT AND REMOVE IT 82 // on its behalf. THIS WILL MOST LIKELY RELEASE THE OBJECT AND REMOVE IT
83 // FROM OUR LIST. 83 // FROM OUR LIST.
84 i->second.first->Release(); 84 i->second.first->Release();
85 } 85 }
86 } 86 }
87 87
88 void ResourceTracker::ReleaseResourceSoon(PP_Resource res) { 88 void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
89 MessageLoop::current()->PostNonNestableTask( 89 base::MessageLoop::current()->PostNonNestableTask(
90 FROM_HERE, 90 FROM_HERE,
91 RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource, 91 RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
92 weak_ptr_factory_.GetWeakPtr(), 92 weak_ptr_factory_.GetWeakPtr(),
93 res))); 93 res)));
94 } 94 }
95 95
96 void ResourceTracker::DidCreateInstance(PP_Instance instance) { 96 void ResourceTracker::DidCreateInstance(PP_Instance instance) {
97 CheckThreadingPreconditions(); 97 CheckThreadingPreconditions();
98 // Due to the infrastructure of some tests, the instance is registered 98 // Due to the infrastructure of some tests, the instance is registered
99 // twice in a few cases. It would be nice not to do that and assert here 99 // twice in a few cases. It would be nice not to do that and assert here
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 CHECK(object->pp_instance() || is_message_loop); 223 CHECK(object->pp_instance() || is_message_loop);
224 CallbackTracker* callback_tracker = 224 CallbackTracker* callback_tracker =
225 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance()); 225 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance());
226 CHECK(callback_tracker || is_message_loop); 226 CHECK(callback_tracker || is_message_loop);
227 if (callback_tracker) 227 if (callback_tracker)
228 callback_tracker->PostAbortForResource(object->pp_resource()); 228 callback_tracker->PostAbortForResource(object->pp_resource());
229 object->NotifyLastPluginRefWasDeleted(); 229 object->NotifyLastPluginRefWasDeleted();
230 } 230 }
231 231
232 } // namespace ppapi 232 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/proxy_completion_callback_factory.h ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698