| 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.h" | 7 #include "base/message_loop.h" |
| 8 #include "ppapi/c/dev/ppb_testing_dev.h" | 8 #include "ppapi/c/dev/ppb_testing_dev.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 ProxyAutoLock lock; | 107 ProxyAutoLock lock; |
| 108 std::vector<PP_Var> vars = | 108 std::vector<PP_Var> vars = |
| 109 PpapiGlobals::Get()->GetVarTracker()->GetLiveVars(); | 109 PpapiGlobals::Get()->GetVarTracker()->GetLiveVars(); |
| 110 for (size_t i = 0u; | 110 for (size_t i = 0u; |
| 111 i < std::min(static_cast<size_t>(array_size), vars.size()); | 111 i < std::min(static_cast<size_t>(array_size), vars.size()); |
| 112 ++i) | 112 ++i) |
| 113 live_vars[i] = vars[i]; | 113 live_vars[i] = vars[i]; |
| 114 return vars.size(); | 114 return vars.size(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SetMinimumArrayBufferSizeForShmem(PP_Instance instance, |
| 118 uint32_t threshold) { |
| 119 ProxyAutoLock lock; |
| 120 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold); |
| 121 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 122 if (!dispatcher) |
| 123 return; |
| 124 dispatcher->Send( |
| 125 new PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem( |
| 126 API_ID_PPB_TESTING, threshold)); |
| 127 } |
| 128 |
| 117 const PPB_Testing_Dev testing_interface = { | 129 const PPB_Testing_Dev testing_interface = { |
| 118 &ReadImageData, | 130 &ReadImageData, |
| 119 &RunMessageLoop, | 131 &RunMessageLoop, |
| 120 &QuitMessageLoop, | 132 &QuitMessageLoop, |
| 121 &GetLiveObjectsForInstance, | 133 &GetLiveObjectsForInstance, |
| 122 &IsOutOfProcess, | 134 &IsOutOfProcess, |
| 123 &SimulateInputEvent, | 135 &SimulateInputEvent, |
| 124 &GetDocumentURL, | 136 &GetDocumentURL, |
| 125 &GetLiveVars | 137 &GetLiveVars, |
| 138 &SetMinimumArrayBufferSizeForShmem |
| 126 }; | 139 }; |
| 127 | 140 |
| 128 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { | 141 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { |
| 129 return new PPB_Testing_Proxy(dispatcher); | 142 return new PPB_Testing_Proxy(dispatcher); |
| 130 } | 143 } |
| 131 | 144 |
| 132 } // namespace | 145 } // namespace |
| 133 | 146 |
| 134 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) | 147 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) |
| 135 : InterfaceProxy(dispatcher), | 148 : InterfaceProxy(dispatcher), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 160 return false; | 173 return false; |
| 161 | 174 |
| 162 bool handled = true; | 175 bool handled = true; |
| 163 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) | 176 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) |
| 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, | 177 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, |
| 165 OnMsgReadImageData) | 178 OnMsgReadImageData) |
| 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance, | 179 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance, |
| 167 OnMsgGetLiveObjectsForInstance) | 180 OnMsgGetLiveObjectsForInstance) |
| 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent, | 181 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent, |
| 169 OnMsgSimulateInputEvent) | 182 OnMsgSimulateInputEvent) |
| 183 IPC_MESSAGE_HANDLER( |
| 184 PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem, |
| 185 OnMsgSetMinimumArrayBufferSizeForShmem) |
| 170 IPC_MESSAGE_UNHANDLED(handled = false) | 186 IPC_MESSAGE_UNHANDLED(handled = false) |
| 171 IPC_END_MESSAGE_MAP() | 187 IPC_END_MESSAGE_MAP() |
| 172 return handled; | 188 return handled; |
| 173 } | 189 } |
| 174 | 190 |
| 175 void PPB_Testing_Proxy::OnMsgReadImageData( | 191 void PPB_Testing_Proxy::OnMsgReadImageData( |
| 176 const HostResource& device_context_2d, | 192 const HostResource& device_context_2d, |
| 177 const HostResource& image, | 193 const HostResource& image, |
| 178 const PP_Point& top_left, | 194 const PP_Point& top_left, |
| 179 PP_Bool* result) { | 195 PP_Bool* result) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 196 | 212 |
| 197 void PPB_Testing_Proxy::OnMsgSimulateInputEvent( | 213 void PPB_Testing_Proxy::OnMsgSimulateInputEvent( |
| 198 PP_Instance instance, | 214 PP_Instance instance, |
| 199 const InputEventData& input_event) { | 215 const InputEventData& input_event) { |
| 200 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( | 216 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( |
| 201 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); | 217 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); |
| 202 ppb_testing_impl_->SimulateInputEvent(instance, | 218 ppb_testing_impl_->SimulateInputEvent(instance, |
| 203 input_event_impl->pp_resource()); | 219 input_event_impl->pp_resource()); |
| 204 } | 220 } |
| 205 | 221 |
| 222 void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem( |
| 223 uint32_t threshold) { |
| 224 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold); |
| 225 } |
| 226 |
| 206 } // namespace proxy | 227 } // namespace proxy |
| 207 } // namespace ppapi | 228 } // namespace ppapi |
| OLD | NEW |