| 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/proxy/ppb_core_proxy.h" | 5 #include "ppapi/proxy/ppb_core_proxy.h" |
| 6 | 6 |
| 7 #include <stdlib.h> // For malloc | 7 #include <stdlib.h> // For malloc |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 int32_t result) { | 55 int32_t result) { |
| 56 DCHECK(callback.func); | 56 DCHECK(callback.func); |
| 57 #if defined(OS_NACL) | 57 #if defined(OS_NACL) |
| 58 // Some NaCl apps pass a negative delay, so we just sanitize to 0, to run as | 58 // Some NaCl apps pass a negative delay, so we just sanitize to 0, to run as |
| 59 // soon as possible. MessageLoop checks that the delay is non-negative. | 59 // soon as possible. MessageLoop checks that the delay is non-negative. |
| 60 if (delay_in_ms < 0) | 60 if (delay_in_ms < 0) |
| 61 delay_in_ms = 0; | 61 delay_in_ms = 0; |
| 62 #endif | 62 #endif |
| 63 if (!callback.func) | 63 if (!callback.func) |
| 64 return; | 64 return; |
| 65 ProxyAutoLock lock; |
| 65 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask( | 66 PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask( |
| 66 FROM_HERE, | 67 FROM_HERE, |
| 67 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), | 68 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), |
| 68 base::TimeDelta::FromMilliseconds(delay_in_ms)); | 69 base::TimeDelta::FromMilliseconds(delay_in_ms)); |
| 69 } | 70 } |
| 70 | 71 |
| 71 PP_Bool IsMainThread() { | 72 PP_Bool IsMainThread() { |
| 72 return PP_FromBool(PpapiGlobals::Get()-> | 73 return PP_FromBool(PpapiGlobals::Get()-> |
| 73 GetMainThreadMessageLoop()->BelongsToCurrentThread()); | 74 GetMainThreadMessageLoop()->BelongsToCurrentThread()); |
| 74 } | 75 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ppb_core_impl_->AddRefResource(resource.host_resource()); | 122 ppb_core_impl_->AddRefResource(resource.host_resource()); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { | 125 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { |
| 125 ppb_core_impl_->ReleaseResource(resource.host_resource()); | 126 ppb_core_impl_->ReleaseResource(resource.host_resource()); |
| 126 } | 127 } |
| 127 #endif // !defined(OS_NACL) | 128 #endif // !defined(OS_NACL) |
| 128 | 129 |
| 129 } // namespace proxy | 130 } // namespace proxy |
| 130 } // namespace ppapi | 131 } // namespace ppapi |
| OLD | NEW |