Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: ppapi/proxy/ppb_testing_proxy.cc

Issue 1114623002: Plugin Power Saver: Make PPS work well with prerendered pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/tests/power_saver_test_plugin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 uint32_t result = 0; 73 uint32_t result = 0;
74 dispatcher->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance( 74 dispatcher->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance(
75 API_ID_PPB_TESTING, instance_id, &result)); 75 API_ID_PPB_TESTING, instance_id, &result));
76 return result; 76 return result;
77 } 77 }
78 78
79 PP_Bool IsOutOfProcess() { 79 PP_Bool IsOutOfProcess() {
80 return PP_TRUE; 80 return PP_TRUE;
81 } 81 }
82 82
83 PP_Bool IsPeripheral(PP_Instance instance_id) { 83 void PostPowerSaverStatus(PP_Instance instance_id) {
84 ProxyAutoLock lock; 84 ProxyAutoLock lock;
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;
88 88
89 PP_Bool result = PP_FALSE; 89 dispatcher->Send(new PpapiHostMsg_PPBTesting_PostPowerSaverStatus(
90 dispatcher->Send(new PpapiHostMsg_PPBTesting_IsPeripheral( 90 API_ID_PPB_TESTING, instance_id));
91 API_ID_PPB_TESTING, instance_id, &result)); 91 }
92 return result; 92
93 void SubscribeToPowerSaverNotifications(PP_Instance instance_id) {
94 ProxyAutoLock lock;
95 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
96 if (!dispatcher)
97 return;
98
99 dispatcher->Send(
100 new PpapiHostMsg_PPBTesting_SubscribeToPowerSaverNotifications(
101 API_ID_PPB_TESTING, instance_id));
93 } 102 }
94 103
95 void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) { 104 void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) {
96 ProxyAutoLock lock; 105 ProxyAutoLock lock;
97 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); 106 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
98 if (!dispatcher) 107 if (!dispatcher)
99 return; 108 return;
100 EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false); 109 EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false);
101 if (enter.failed()) 110 if (enter.failed())
102 return; 111 return;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // TODO(raymes): Implement this if we need it. 152 // TODO(raymes): Implement this if we need it.
144 NOTIMPLEMENTED(); 153 NOTIMPLEMENTED();
145 } 154 }
146 155
147 const PPB_Testing_Private testing_interface = { 156 const PPB_Testing_Private testing_interface = {
148 &ReadImageData, 157 &ReadImageData,
149 &RunMessageLoop, 158 &RunMessageLoop,
150 &QuitMessageLoop, 159 &QuitMessageLoop,
151 &GetLiveObjectsForInstance, 160 &GetLiveObjectsForInstance,
152 &IsOutOfProcess, 161 &IsOutOfProcess,
153 &IsPeripheral, 162 &PostPowerSaverStatus,
163 &SubscribeToPowerSaverNotifications,
154 &SimulateInputEvent, 164 &SimulateInputEvent,
155 &GetDocumentURL, 165 &GetDocumentURL,
156 &GetLiveVars, 166 &GetLiveVars,
157 &SetMinimumArrayBufferSizeForShmem, 167 &SetMinimumArrayBufferSizeForShmem,
158 &RunV8GC}; 168 &RunV8GC};
159 169
160 } // namespace 170 } // namespace
161 171
162 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) 172 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher)
163 : InterfaceProxy(dispatcher), 173 : InterfaceProxy(dispatcher),
(...skipping 15 matching lines...) Expand all
179 bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { 189 bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) {
180 if (!dispatcher()->permissions().HasPermission(PERMISSION_TESTING)) 190 if (!dispatcher()->permissions().HasPermission(PERMISSION_TESTING))
181 return false; 191 return false;
182 192
183 bool handled = true; 193 bool handled = true;
184 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) 194 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg)
185 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, 195 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData,
186 OnMsgReadImageData) 196 OnMsgReadImageData)
187 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance, 197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
188 OnMsgGetLiveObjectsForInstance) 198 OnMsgGetLiveObjectsForInstance)
189 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_IsPeripheral, OnMsgIsPeripheral) 199 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_PostPowerSaverStatus,
200 OnMsgPostPowerSaverStatus)
201 IPC_MESSAGE_HANDLER(
202 PpapiHostMsg_PPBTesting_SubscribeToPowerSaverNotifications,
203 OnMsgSubscribeToPowerSaverNotifications)
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 12 matching lines...) Expand all
212 226
213 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { 227 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
214 ppb_testing_impl_->QuitMessageLoop(instance); 228 ppb_testing_impl_->QuitMessageLoop(instance);
215 } 229 }
216 230
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::OnMsgPostPowerSaverStatus(PP_Instance instance) {
223 PP_Bool* result) { 237 ppb_testing_impl_->PostPowerSaverStatus(instance);
224 *result = ppb_testing_impl_->IsPeripheral(instance); 238 }
239
240 void PPB_Testing_Proxy::OnMsgSubscribeToPowerSaverNotifications(
241 PP_Instance instance) {
242 ppb_testing_impl_->SubscribeToPowerSaverNotifications(instance);
225 } 243 }
226 244
227 void PPB_Testing_Proxy::OnMsgSimulateInputEvent( 245 void PPB_Testing_Proxy::OnMsgSimulateInputEvent(
228 PP_Instance instance, 246 PP_Instance instance,
229 const InputEventData& input_event) { 247 const InputEventData& input_event) {
230 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( 248 scoped_refptr<PPB_InputEvent_Shared> input_event_impl(
231 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); 249 new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event));
232 ppb_testing_impl_->SimulateInputEvent(instance, 250 ppb_testing_impl_->SimulateInputEvent(instance,
233 input_event_impl->pp_resource()); 251 input_event_impl->pp_resource());
234 } 252 }
235 253
236 void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem( 254 void PPB_Testing_Proxy::OnMsgSetMinimumArrayBufferSizeForShmem(
237 uint32_t threshold) { 255 uint32_t threshold) {
238 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold); 256 RawVarDataGraph::SetMinimumArrayBufferSizeForShmemForTest(threshold);
239 } 257 }
240 258
241 } // namespace proxy 259 } // namespace proxy
242 } // namespace ppapi 260 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/tests/power_saver_test_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698