Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 | 56 |
| 57 void CallOnMainThread(int delay_in_ms, | 57 void CallOnMainThread(int delay_in_ms, |
| 58 PP_CompletionCallback callback, | 58 PP_CompletionCallback callback, |
| 59 int32_t result) { | 59 int32_t result) { |
| 60 GetMainThreadMessageLoop()->PostDelayedTask( | 60 GetMainThreadMessageLoop()->PostDelayedTask( |
| 61 FROM_HERE, | 61 FROM_HERE, |
| 62 NewRunnableFunction(callback.func, callback.user_data, result), | 62 NewRunnableFunction(callback.func, callback.user_data, result), |
| 63 delay_in_ms); | 63 delay_in_ms); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool IsMainThread() { | 66 PP_Bool IsMainThread() { |
| 67 return GetMainThreadMessageLoop()->BelongsToCurrentThread(); | 67 return GetMainThreadMessageLoop()->BelongsToCurrentThread() ? PP_TRUE |
| 68 : PP_FALSE; | |
|
dmichael(do not use this one)
2010/11/08 15:31:19
Why not use your convenience functions?
| |
| 68 } | 69 } |
| 69 | 70 |
| 70 const PPB_Core core_interface = { | 71 const PPB_Core core_interface = { |
| 71 &AddRefResource, | 72 &AddRefResource, |
| 72 &ReleaseResource, | 73 &ReleaseResource, |
| 73 &MemAlloc, | 74 &MemAlloc, |
| 74 &MemFree, | 75 &MemFree, |
| 75 &GetTime, | 76 &GetTime, |
| 76 &GetTimeTicks, | 77 &GetTimeTicks, |
| 77 &CallOnMainThread, | 78 &CallOnMainThread, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 void PPB_Core_Proxy::OnMsgAddRefResource(PP_Resource resource) { | 110 void PPB_Core_Proxy::OnMsgAddRefResource(PP_Resource resource) { |
| 110 ppb_core_target()->AddRefResource(resource); | 111 ppb_core_target()->AddRefResource(resource); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void PPB_Core_Proxy::OnMsgReleaseResource(PP_Resource resource) { | 114 void PPB_Core_Proxy::OnMsgReleaseResource(PP_Resource resource) { |
| 114 ppb_core_target()->ReleaseResource(resource); | 115 ppb_core_target()->ReleaseResource(resource); |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace proxy | 118 } // namespace proxy |
| 118 } // namespace pp | 119 } // namespace pp |
| OLD | NEW |