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

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

Issue 6432001: Implement proxy for FlashMenu and Run/QuitMessageLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle NULL menus more gracefully Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/proxy/serialized_flash_menu.h » ('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) 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_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/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/plugin_resource.h" 10 #include "ppapi/proxy/plugin_resource.h"
(...skipping 23 matching lines...) Expand all
34 if (!dispatcher) 34 if (!dispatcher)
35 return PP_FALSE; 35 return PP_FALSE;
36 36
37 PP_Bool result = PP_FALSE; 37 PP_Bool result = PP_FALSE;
38 dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData( 38 dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData(
39 INTERFACE_ID_PPB_TESTING, graphics_2d_object->host_resource(), 39 INTERFACE_ID_PPB_TESTING, graphics_2d_object->host_resource(),
40 image_object->host_resource(), *top_left, &result)); 40 image_object->host_resource(), *top_left, &result));
41 return result; 41 return result;
42 } 42 }
43 43
44 void RunMessageLoop() { 44 void RunMessageLoop(PP_Instance instance) {
45 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 45 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
46 MessageLoop::current()->SetNestableTasksAllowed(true); 46 if (!dispatcher)
47 MessageLoop::current()->Run(); 47 return;
48 MessageLoop::current()->SetNestableTasksAllowed(old_state); 48 IPC::SyncMessage* msg = new PpapiHostMsg_PPBTesting_RunMessageLoop(
49 INTERFACE_ID_PPB_TESTING, instance);
50 msg->EnableMessagePumping();
51 dispatcher->Send(msg);
49 } 52 }
50 53
51 void QuitMessageLoop() { 54 void QuitMessageLoop(PP_Instance instance) {
52 MessageLoop::current()->QuitNow(); 55 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
56 if (!dispatcher)
57 return;
58 dispatcher->Send(new PpapiHostMsg_PPBTesting_QuitMessageLoop(
59 INTERFACE_ID_PPB_TESTING, instance));
53 } 60 }
54 61
55 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { 62 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
56 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); 63 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
57 if (!dispatcher) 64 if (!dispatcher)
58 return static_cast<uint32_t>(-1); 65 return static_cast<uint32_t>(-1);
59 66
60 uint32_t result = 0; 67 uint32_t result = 0;
61 dispatcher->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance( 68 dispatcher->Send(new PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance(
62 INTERFACE_ID_PPB_TESTING, instance_id, &result)); 69 INTERFACE_ID_PPB_TESTING, instance_id, &result));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 122
116 void PPB_Testing_Proxy::OnMsgReadImageData( 123 void PPB_Testing_Proxy::OnMsgReadImageData(
117 const HostResource& device_context_2d, 124 const HostResource& device_context_2d,
118 const HostResource& image, 125 const HostResource& image,
119 const PP_Point& top_left, 126 const PP_Point& top_left,
120 PP_Bool* result) { 127 PP_Bool* result) {
121 *result = ppb_testing_target()->ReadImageData( 128 *result = ppb_testing_target()->ReadImageData(
122 device_context_2d.host_resource(), image.host_resource(), &top_left); 129 device_context_2d.host_resource(), image.host_resource(), &top_left);
123 } 130 }
124 131
125 void PPB_Testing_Proxy::OnMsgRunMessageLoop(bool* dummy) { 132 void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
126 ppb_testing_target()->RunMessageLoop(); 133 ppb_testing_target()->RunMessageLoop(instance);
127 *dummy = false;
128 } 134 }
129 135
130 void PPB_Testing_Proxy::OnMsgQuitMessageLoop() { 136 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
131 ppb_testing_target()->QuitMessageLoop(); 137 ppb_testing_target()->QuitMessageLoop(instance);
132 } 138 }
133 139
134 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, 140 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance,
135 uint32_t* result) { 141 uint32_t* result) {
136 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance); 142 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance);
137 } 143 }
138 144
139 } // namespace proxy 145 } // namespace proxy
140 } // namespace pp 146 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/proxy/serialized_flash_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698