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_testing_proxy.h" | 5 #include "ppapi/proxy/ppb_testing_proxy.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "ppapi/c/private/ppb_testing_private.h" | 8 #include "ppapi/c/private/ppb_testing_private.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); | 85 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
86 if (!dispatcher) | 86 if (!dispatcher) |
87 return PP_FALSE; | 87 return PP_FALSE; |
88 | 88 |
89 PP_Bool result = PP_FALSE; | 89 PP_Bool result = PP_FALSE; |
90 dispatcher->Send(new PpapiHostMsg_PPBTesting_IsPeripheral( | 90 dispatcher->Send(new PpapiHostMsg_PPBTesting_IsPeripheral( |
91 API_ID_PPB_TESTING, instance_id, &result)); | 91 API_ID_PPB_TESTING, instance_id, &result)); |
92 return result; | 92 return result; |
93 } | 93 } |
94 | 94 |
| 95 PP_Bool IsThrottled(PP_Instance instance_id) { |
| 96 ProxyAutoLock lock; |
| 97 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
| 98 if (!dispatcher) |
| 99 return PP_FALSE; |
| 100 |
| 101 PP_Bool result = PP_FALSE; |
| 102 dispatcher->Send(new PpapiHostMsg_PPBTesting_IsThrottled( |
| 103 API_ID_PPB_TESTING, instance_id, &result)); |
| 104 return result; |
| 105 } |
| 106 |
95 void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) { | 107 void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) { |
96 ProxyAutoLock lock; | 108 ProxyAutoLock lock; |
97 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); | 109 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
98 if (!dispatcher) | 110 if (!dispatcher) |
99 return; | 111 return; |
100 EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false); | 112 EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false); |
101 if (enter.failed()) | 113 if (enter.failed()) |
102 return; | 114 return; |
103 | 115 |
104 const InputEventData& input_event_data = enter.object()->GetInputEventData(); | 116 const InputEventData& input_event_data = enter.object()->GetInputEventData(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 NOTIMPLEMENTED(); | 156 NOTIMPLEMENTED(); |
145 } | 157 } |
146 | 158 |
147 const PPB_Testing_Private testing_interface = { | 159 const PPB_Testing_Private testing_interface = { |
148 &ReadImageData, | 160 &ReadImageData, |
149 &RunMessageLoop, | 161 &RunMessageLoop, |
150 &QuitMessageLoop, | 162 &QuitMessageLoop, |
151 &GetLiveObjectsForInstance, | 163 &GetLiveObjectsForInstance, |
152 &IsOutOfProcess, | 164 &IsOutOfProcess, |
153 &IsPeripheral, | 165 &IsPeripheral, |
| 166 &IsThrottled, |
154 &SimulateInputEvent, | 167 &SimulateInputEvent, |
155 &GetDocumentURL, | 168 &GetDocumentURL, |
156 &GetLiveVars, | 169 &GetLiveVars, |
157 &SetMinimumArrayBufferSizeForShmem, | 170 &SetMinimumArrayBufferSizeForShmem, |
158 &RunV8GC}; | 171 &RunV8GC}; |
159 | 172 |
160 } // namespace | 173 } // namespace |
161 | 174 |
162 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) | 175 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) |
163 : InterfaceProxy(dispatcher), | 176 : InterfaceProxy(dispatcher), |
(...skipping 16 matching lines...) Expand all Loading... |
180 if (!dispatcher()->permissions().HasPermission(PERMISSION_TESTING)) | 193 if (!dispatcher()->permissions().HasPermission(PERMISSION_TESTING)) |
181 return false; | 194 return false; |
182 | 195 |
183 bool handled = true; | 196 bool handled = true; |
184 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) | 197 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) |
185 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, | 198 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, |
186 OnMsgReadImageData) | 199 OnMsgReadImageData) |
187 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance, | 200 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance, |
188 OnMsgGetLiveObjectsForInstance) | 201 OnMsgGetLiveObjectsForInstance) |
189 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_IsPeripheral, OnMsgIsPeripheral) | 202 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_IsPeripheral, OnMsgIsPeripheral) |
| 203 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_IsThrottled, OnMsgIsThrottled) |
190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent, | 204 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent, |
191 OnMsgSimulateInputEvent) | 205 OnMsgSimulateInputEvent) |
192 IPC_MESSAGE_HANDLER( | 206 IPC_MESSAGE_HANDLER( |
193 PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem, | 207 PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem, |
194 OnMsgSetMinimumArrayBufferSizeForShmem) | 208 OnMsgSetMinimumArrayBufferSizeForShmem) |
195 IPC_MESSAGE_UNHANDLED(handled = false) | 209 IPC_MESSAGE_UNHANDLED(handled = false) |
196 IPC_END_MESSAGE_MAP() | 210 IPC_END_MESSAGE_MAP() |
197 return handled; | 211 return handled; |
198 } | 212 } |
199 | 213 |
(...skipping 17 matching lines...) Expand all Loading... |
217 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, | 231 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, |
218 uint32_t* result) { | 232 uint32_t* result) { |
219 *result = ppb_testing_impl_->GetLiveObjectsForInstance(instance); | 233 *result = ppb_testing_impl_->GetLiveObjectsForInstance(instance); |
220 } | 234 } |
221 | 235 |
222 void PPB_Testing_Proxy::OnMsgIsPeripheral(PP_Instance instance, | 236 void PPB_Testing_Proxy::OnMsgIsPeripheral(PP_Instance instance, |
223 PP_Bool* result) { | 237 PP_Bool* result) { |
224 *result = ppb_testing_impl_->IsPeripheral(instance); | 238 *result = ppb_testing_impl_->IsPeripheral(instance); |
225 } | 239 } |
226 | 240 |
| 241 void PPB_Testing_Proxy::OnMsgIsThrottled(PP_Instance instance, |
| 242 PP_Bool* result) { |
| 243 *result = ppb_testing_impl_->IsThrottled(instance); |
| 244 } |
| 245 |
227 void PPB_Testing_Proxy::OnMsgSimulateInputEvent( | 246 void PPB_Testing_Proxy::OnMsgSimulateInputEvent( |
228 PP_Instance instance, | 247 PP_Instance instance, |
229 const InputEventData& input_event) { | 248 const InputEventData& input_event) { |
230 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( | 249 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( |
231 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); | 250 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); |
232 ppb_testing_impl_->SimulateInputEvent(instance, | 251 ppb_testing_impl_->SimulateInputEvent(instance, |
233 input_event_impl->pp_resource()); | 252 input_event_impl->pp_resource()); |
234 } | 253 } |
235 | 254 |
236 void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem( | 255 void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem( |
237 uint32_t threshold) { | 256 uint32_t threshold) { |
238 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold); | 257 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold); |
239 } | 258 } |
240 | 259 |
241 } // namespace proxy | 260 } // namespace proxy |
242 } // namespace ppapi | 261 } // namespace ppapi |
OLD | NEW |