OLD | NEW |
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/thread_aware_callback.h" | 5 #include "ppapi/shared_impl/thread_aware_callback.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
10 #include "ppapi/shared_impl/ppb_message_loop_shared.h" | 10 #include "ppapi/shared_impl/ppb_message_loop_shared.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 core_->MarkAsAborted(); | 42 core_->MarkAsAborted(); |
43 } | 43 } |
44 | 44 |
45 // static | 45 // static |
46 bool ThreadAwareCallbackBase::HasTargetLoop() { | 46 bool ThreadAwareCallbackBase::HasTargetLoop() { |
47 return !!PpapiGlobals::Get()->GetCurrentMessageLoop(); | 47 return !!PpapiGlobals::Get()->GetCurrentMessageLoop(); |
48 } | 48 } |
49 | 49 |
50 void ThreadAwareCallbackBase::InternalRunOnTargetThread( | 50 void ThreadAwareCallbackBase::InternalRunOnTargetThread( |
51 const base::Closure& closure) { | 51 const base::Closure& closure) { |
52 if (target_loop_ != PpapiGlobals::Get()->GetCurrentMessageLoop()) { | 52 if (target_loop_.get() != PpapiGlobals::Get()->GetCurrentMessageLoop()) { |
53 target_loop_->PostClosure( | 53 target_loop_->PostClosure( |
54 FROM_HERE, | 54 FROM_HERE, |
55 RunWhileLocked(base::Bind(&Core::RunIfNotAborted, core_, closure)), | 55 RunWhileLocked(base::Bind(&Core::RunIfNotAborted, core_, closure)), |
56 0); | 56 0); |
57 } else { | 57 } else { |
58 CallWhileUnlocked(closure); | 58 CallWhileUnlocked(closure); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 } // namespace internal | 62 } // namespace internal |
63 } // namespace ppapi | 63 } // namespace ppapi |
OLD | NEW |