| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| 11 | 11 |
| 12 namespace pp { | 12 namespace pp { |
| 13 namespace proxy { | 13 namespace proxy { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 bool ReadImageData(PP_Resource device_context_2d, | 17 PP_Bool ReadImageData(PP_Resource device_context_2d, |
| 18 PP_Resource image, | 18 PP_Resource image, |
| 19 const PP_Point* top_left) { | 19 const PP_Point* top_left) { |
| 20 bool result = false; | 20 PP_Bool result = PP_FALSE; |
| 21 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBTesting_ReadImageData( | 21 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBTesting_ReadImageData( |
| 22 INTERFACE_ID_PPB_TESTING, device_context_2d, image, *top_left, &result)); | 22 INTERFACE_ID_PPB_TESTING, device_context_2d, image, *top_left, &result)); |
| 23 return result; | 23 return result; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void RunMessageLoop() { | 26 void RunMessageLoop() { |
| 27 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 27 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
| 28 MessageLoop::current()->SetNestableTasksAllowed(true); | 28 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 29 MessageLoop::current()->Run(); | 29 MessageLoop::current()->Run(); |
| 30 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 30 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_QuitMessageLoop, | 75 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_QuitMessageLoop, |
| 76 OnMsgQuitMessageLoop) | 76 OnMsgQuitMessageLoop) |
| 77 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectCount, | 77 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectCount, |
| 78 OnMsgGetLiveObjectCount) | 78 OnMsgGetLiveObjectCount) |
| 79 IPC_END_MESSAGE_MAP() | 79 IPC_END_MESSAGE_MAP() |
| 80 } | 80 } |
| 81 | 81 |
| 82 void PPB_Testing_Proxy::OnMsgReadImageData(PP_Resource device_context_2d, | 82 void PPB_Testing_Proxy::OnMsgReadImageData(PP_Resource device_context_2d, |
| 83 PP_Resource image, | 83 PP_Resource image, |
| 84 const PP_Point& top_left, | 84 const PP_Point& top_left, |
| 85 bool* result) { | 85 PP_Bool* result) { |
| 86 *result = ppb_testing_target()->ReadImageData( | 86 *result = ppb_testing_target()->ReadImageData( |
| 87 device_context_2d, image, &top_left); | 87 device_context_2d, image, &top_left); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void PPB_Testing_Proxy::OnMsgRunMessageLoop(bool* dummy) { | 90 void PPB_Testing_Proxy::OnMsgRunMessageLoop(bool* dummy) { |
| 91 ppb_testing_target()->RunMessageLoop(); | 91 ppb_testing_target()->RunMessageLoop(); |
| 92 *dummy = false; | 92 *dummy = false; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void PPB_Testing_Proxy::OnMsgQuitMessageLoop() { | 95 void PPB_Testing_Proxy::OnMsgQuitMessageLoop() { |
| 96 ppb_testing_target()->QuitMessageLoop(); | 96 ppb_testing_target()->QuitMessageLoop(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void PPB_Testing_Proxy::OnMsgGetLiveObjectCount(PP_Module module_id, | 99 void PPB_Testing_Proxy::OnMsgGetLiveObjectCount(PP_Module module_id, |
| 100 uint32_t* result) { | 100 uint32_t* result) { |
| 101 *result = ppb_testing_target()->GetLiveObjectCount(module_id); | 101 *result = ppb_testing_target()->GetLiveObjectCount(module_id); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace proxy | 104 } // namespace proxy |
| 105 } // namespace pp | 105 } // namespace pp |
| OLD | NEW |