| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return result; | 63 return result; |
| 64 } | 64 } |
| 65 | 65 |
| 66 const PPB_Testing_Dev testing_interface = { | 66 const PPB_Testing_Dev testing_interface = { |
| 67 &ReadImageData, | 67 &ReadImageData, |
| 68 &RunMessageLoop, | 68 &RunMessageLoop, |
| 69 &QuitMessageLoop, | 69 &QuitMessageLoop, |
| 70 &GetLiveObjectsForInstance | 70 &GetLiveObjectsForInstance |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher, |
| 74 const void* target_interface) { |
| 75 return new PPB_Testing_Proxy(dispatcher, target_interface); |
| 76 } |
| 77 |
| 73 } // namespace | 78 } // namespace |
| 74 | 79 |
| 75 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher, | 80 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher, |
| 76 const void* target_interface) | 81 const void* target_interface) |
| 77 : InterfaceProxy(dispatcher, target_interface) { | 82 : InterfaceProxy(dispatcher, target_interface) { |
| 78 } | 83 } |
| 79 | 84 |
| 80 PPB_Testing_Proxy::~PPB_Testing_Proxy() { | 85 PPB_Testing_Proxy::~PPB_Testing_Proxy() { |
| 81 } | 86 } |
| 82 | 87 |
| 83 const void* PPB_Testing_Proxy::GetSourceInterface() const { | 88 // static |
| 84 return &testing_interface; | 89 const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() { |
| 85 } | 90 static const Info info = { |
| 86 | 91 &testing_interface, |
| 87 InterfaceID PPB_Testing_Proxy::GetInterfaceId() const { | 92 PPB_TESTING_DEV_INTERFACE, |
| 88 return INTERFACE_ID_PPB_TESTING; | 93 INTERFACE_ID_PPB_TESTING, |
| 94 false, |
| 95 &CreateTestingProxy, |
| 96 }; |
| 97 return &info; |
| 89 } | 98 } |
| 90 | 99 |
| 91 bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { | 100 bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 92 bool handled = true; | 101 bool handled = true; |
| 93 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) | 102 IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) |
| 94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, | 103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, |
| 95 OnMsgReadImageData) | 104 OnMsgReadImageData) |
| 96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_RunMessageLoop, | 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_RunMessageLoop, |
| 97 OnMsgRunMessageLoop) | 106 OnMsgRunMessageLoop) |
| 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_QuitMessageLoop, | 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_QuitMessageLoop, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 122 ppb_testing_target()->QuitMessageLoop(); | 131 ppb_testing_target()->QuitMessageLoop(); |
| 123 } | 132 } |
| 124 | 133 |
| 125 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, | 134 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, |
| 126 uint32_t* result) { | 135 uint32_t* result) { |
| 127 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance); | 136 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance); |
| 128 } | 137 } |
| 129 | 138 |
| 130 } // namespace proxy | 139 } // namespace proxy |
| 131 } // namespace pp | 140 } // namespace pp |
| OLD | NEW |