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

Side by Side Diff: ppapi/shared_impl/tracked_callback.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/shared_impl/resource_tracker.cc ('k') | ppapi/shared_impl/tracked_callback_unittest.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/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.h" 10 #include "base/message_loop.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // should never try to PostRun more than once otherwise. 150 // should never try to PostRun more than once otherwise.
151 DCHECK(result == PP_ERROR_ABORTED || !is_scheduled_); 151 DCHECK(result == PP_ERROR_ABORTED || !is_scheduled_);
152 152
153 base::Closure callback_closure( 153 base::Closure callback_closure(
154 RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result))); 154 RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result)));
155 if (!target_loop_) { 155 if (!target_loop_) {
156 // We must be running in-process and on the main thread (the Enter 156 // We must be running in-process and on the main thread (the Enter
157 // classes protect against having a null target_loop_ otherwise). 157 // classes protect against having a null target_loop_ otherwise).
158 DCHECK(IsMainThread()); 158 DCHECK(IsMainThread());
159 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); 159 DCHECK(PpapiGlobals::Get()->IsHostGlobals());
160 MessageLoop::current()->PostTask(FROM_HERE, callback_closure); 160 base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
161 } else { 161 } else {
162 target_loop_->PostClosure(FROM_HERE, callback_closure, 0); 162 target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
163 } 163 }
164 is_scheduled_ = true; 164 is_scheduled_ = true;
165 } 165 }
166 166
167 // static 167 // static
168 bool TrackedCallback::IsPending( 168 bool TrackedCallback::IsPending(
169 const scoped_refptr<TrackedCallback>& callback) { 169 const scoped_refptr<TrackedCallback>& callback) {
170 if (!callback.get()) 170 if (!callback.get())
(...skipping 26 matching lines...) Expand all
197 // until we're done. 197 // until we're done.
198 scoped_refptr<TrackedCallback> thiz = this; 198 scoped_refptr<TrackedCallback> thiz = this;
199 completed_ = true; 199 completed_ = true;
200 // We may not have a valid resource, in which case we're not in the tracker. 200 // We may not have a valid resource, in which case we're not in the tracker.
201 if (resource_id_) 201 if (resource_id_)
202 tracker_->Remove(thiz); 202 tracker_->Remove(thiz);
203 tracker_ = NULL; 203 tracker_ = NULL;
204 } 204 }
205 205
206 } // namespace ppapi 206 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/resource_tracker.cc ('k') | ppapi/shared_impl/tracked_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698