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

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

Issue 467303005: Remove implicit conversions from scoped_refptr to T* in ppapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // should never try to PostRun more than once otherwise. 160 // should never try to PostRun more than once otherwise.
161 DCHECK(result == PP_ERROR_ABORTED || !is_scheduled_); 161 DCHECK(result == PP_ERROR_ABORTED || !is_scheduled_);
162 162
163 if (is_blocking()) { 163 if (is_blocking()) {
164 // We might not have a MessageLoop to post to, so we must call Run() 164 // We might not have a MessageLoop to post to, so we must call Run()
165 // directly. 165 // directly.
166 Run(result); 166 Run(result);
167 } else { 167 } else {
168 base::Closure callback_closure( 168 base::Closure callback_closure(
169 RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result))); 169 RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result)));
170 if (target_loop_) { 170 if (target_loop_.get()) {
171 target_loop_->PostClosure(FROM_HERE, callback_closure, 0); 171 target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
172 } else { 172 } else {
173 // We must be running in-process and on the main thread (the Enter 173 // We must be running in-process and on the main thread (the Enter
174 // classes protect against having a null target_loop_ otherwise). 174 // classes protect against having a null target_loop_ otherwise).
175 DCHECK(IsMainThread()); 175 DCHECK(IsMainThread());
176 DCHECK(PpapiGlobals::Get()->IsHostGlobals()); 176 DCHECK(PpapiGlobals::Get()->IsHostGlobals());
177 base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure); 177 base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
178 } 178 }
179 } 179 }
180 is_scheduled_ = true; 180 is_scheduled_ = true;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // until we're done. 233 // until we're done.
234 scoped_refptr<TrackedCallback> thiz = this; 234 scoped_refptr<TrackedCallback> thiz = this;
235 completed_ = true; 235 completed_ = true;
236 // We may not have a valid resource, in which case we're not in the tracker. 236 // We may not have a valid resource, in which case we're not in the tracker.
237 if (resource_id_) 237 if (resource_id_)
238 tracker_->Remove(thiz); 238 tracker_->Remove(thiz);
239 tracker_ = NULL; 239 tracker_ = NULL;
240 } 240 }
241 241
242 } // namespace ppapi 242 } // namespace ppapi
OLDNEW
« ppapi/proxy/file_io_resource.cc ('K') | « ppapi/proxy/video_decoder_resource.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698