OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void CallOnMainThread(int delay_in_ms, | 58 void CallOnMainThread(int delay_in_ms, |
59 PP_CompletionCallback callback, | 59 PP_CompletionCallback callback, |
60 int32_t result) { | 60 int32_t result) { |
61 GetMainThreadMessageLoop()->PostDelayedTask( | 61 GetMainThreadMessageLoop()->PostDelayedTask( |
62 FROM_HERE, | 62 FROM_HERE, |
63 NewRunnableFunction(callback.func, callback.user_data, result), | 63 NewRunnableFunction(callback.func, callback.user_data, result), |
64 delay_in_ms); | 64 delay_in_ms); |
65 } | 65 } |
66 | 66 |
67 PP_Bool IsMainThread() { | 67 PP_Bool IsMainThread() { |
68 return BoolToPPBool(GetMainThreadMessageLoop()->BelongsToCurrentThread()); | 68 return PP_FromBool(GetMainThreadMessageLoop()->BelongsToCurrentThread()); |
69 } | 69 } |
70 | 70 |
71 const PPB_Core core_interface = { | 71 const PPB_Core core_interface = { |
72 &AddRefResource, | 72 &AddRefResource, |
73 &ReleaseResource, | 73 &ReleaseResource, |
74 &MemAlloc, | 74 &MemAlloc, |
75 &MemFree, | 75 &MemFree, |
76 &GetTime, | 76 &GetTime, |
77 &GetTimeTicks, | 77 &GetTimeTicks, |
78 &CallOnMainThread, | 78 &CallOnMainThread, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void PPB_Core_Proxy::OnMsgAddRefResource(HostResource resource) { | 122 void PPB_Core_Proxy::OnMsgAddRefResource(HostResource resource) { |
123 ppb_core_target()->AddRefResource(resource.host_resource()); | 123 ppb_core_target()->AddRefResource(resource.host_resource()); |
124 } | 124 } |
125 | 125 |
126 void PPB_Core_Proxy::OnMsgReleaseResource(HostResource resource) { | 126 void PPB_Core_Proxy::OnMsgReleaseResource(HostResource resource) { |
127 ppb_core_target()->ReleaseResource(resource.host_resource()); | 127 ppb_core_target()->ReleaseResource(resource.host_resource()); |
128 } | 128 } |
129 | 129 |
130 } // namespace proxy | 130 } // namespace proxy |
131 } // namespace pp | 131 } // namespace pp |
OLD | NEW |