| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 "UserData", callback.user_data); | 57 "UserData", callback.user_data); |
| 58 CallWhileUnlocked(PP_RunCompletionCallback, &callback, result); | 58 CallWhileUnlocked(PP_RunCompletionCallback, &callback, result); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CallOnMainThread(int delay_in_ms, | 61 void CallOnMainThread(int delay_in_ms, |
| 62 PP_CompletionCallback callback, | 62 PP_CompletionCallback callback, |
| 63 int32_t result) { | 63 int32_t result) { |
| 64 GetMainThreadMessageLoop()->PostDelayedTask( | 64 GetMainThreadMessageLoop()->PostDelayedTask( |
| 65 FROM_HERE, | 65 FROM_HERE, |
| 66 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), | 66 RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), |
| 67 delay_in_ms); | 67 base::TimeDelta::FromMilliseconds(delay_in_ms)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 PP_Bool IsMainThread() { | 70 PP_Bool IsMainThread() { |
| 71 return PP_FromBool(GetMainThreadMessageLoop()->BelongsToCurrentThread()); | 71 return PP_FromBool(GetMainThreadMessageLoop()->BelongsToCurrentThread()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 const PPB_Core core_interface = { | 74 const PPB_Core core_interface = { |
| 75 &AddRefResource, | 75 &AddRefResource, |
| 76 &ReleaseResource, | 76 &ReleaseResource, |
| 77 &GetTime, | 77 &GetTime, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { | 115 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { |
| 116 ppb_core_impl_->AddRefResource(resource.host_resource()); | 116 ppb_core_impl_->AddRefResource(resource.host_resource()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { | 119 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { |
| 120 ppb_core_impl_->ReleaseResource(resource.host_resource()); | 120 ppb_core_impl_->ReleaseResource(resource.host_resource()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace proxy | 123 } // namespace proxy |
| 124 } // namespace ppapi | 124 } // namespace ppapi |
| OLD | NEW |