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_tracker.h" | 10 #include "ppapi/proxy/plugin_resource_tracker.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 const PPB_Testing_Dev testing_interface = { | 70 const PPB_Testing_Dev testing_interface = { |
71 &ReadImageData, | 71 &ReadImageData, |
72 &RunMessageLoop, | 72 &RunMessageLoop, |
73 &QuitMessageLoop, | 73 &QuitMessageLoop, |
74 &GetLiveObjectsForInstance, | 74 &GetLiveObjectsForInstance, |
75 &IsOutOfProcess | 75 &IsOutOfProcess |
76 }; | 76 }; |
77 | 77 |
78 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) { | 78 InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher, |
79 return new PPB_Testing_Proxy(dispatcher); | 79 const void* target_interface) { |
| 80 return new PPB_Testing_Proxy(dispatcher, target_interface); |
80 } | 81 } |
81 | 82 |
82 } // namespace | 83 } // namespace |
83 | 84 |
84 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher) | 85 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher, |
85 : InterfaceProxy(dispatcher), | 86 const void* target_interface) |
86 ppb_testing_impl_(NULL) { | 87 : InterfaceProxy(dispatcher, target_interface) { |
87 if (!dispatcher->IsPlugin()) { | |
88 ppb_testing_impl_ = static_cast<const PPB_Testing_Dev*>( | |
89 dispatcher->local_get_interface()(PPB_TESTING_DEV_INTERFACE)); | |
90 } | |
91 } | 88 } |
92 | 89 |
93 PPB_Testing_Proxy::~PPB_Testing_Proxy() { | 90 PPB_Testing_Proxy::~PPB_Testing_Proxy() { |
94 } | 91 } |
95 | 92 |
96 // static | 93 // static |
97 const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() { | 94 const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() { |
98 static const Info info = { | 95 static const Info info = { |
99 &testing_interface, | 96 &testing_interface, |
100 PPB_TESTING_DEV_INTERFACE, | 97 PPB_TESTING_DEV_INTERFACE, |
(...skipping 14 matching lines...) Expand all Loading... |
115 IPC_MESSAGE_UNHANDLED(handled = false) | 112 IPC_MESSAGE_UNHANDLED(handled = false) |
116 IPC_END_MESSAGE_MAP() | 113 IPC_END_MESSAGE_MAP() |
117 return handled; | 114 return handled; |
118 } | 115 } |
119 | 116 |
120 void PPB_Testing_Proxy::OnMsgReadImageData( | 117 void PPB_Testing_Proxy::OnMsgReadImageData( |
121 const HostResource& device_context_2d, | 118 const HostResource& device_context_2d, |
122 const HostResource& image, | 119 const HostResource& image, |
123 const PP_Point& top_left, | 120 const PP_Point& top_left, |
124 PP_Bool* result) { | 121 PP_Bool* result) { |
125 *result = ppb_testing_impl_->ReadImageData( | 122 *result = ppb_testing_target()->ReadImageData( |
126 device_context_2d.host_resource(), image.host_resource(), &top_left); | 123 device_context_2d.host_resource(), image.host_resource(), &top_left); |
127 } | 124 } |
128 | 125 |
129 void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) { | 126 void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) { |
130 ppb_testing_impl_->RunMessageLoop(instance); | 127 ppb_testing_target()->RunMessageLoop(instance); |
131 } | 128 } |
132 | 129 |
133 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { | 130 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { |
134 ppb_testing_impl_->QuitMessageLoop(instance); | 131 ppb_testing_target()->QuitMessageLoop(instance); |
135 } | 132 } |
136 | 133 |
137 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, | 134 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, |
138 uint32_t* result) { | 135 uint32_t* result) { |
139 *result = ppb_testing_impl_->GetLiveObjectsForInstance(instance); | 136 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance); |
140 } | 137 } |
141 | 138 |
142 } // namespace proxy | 139 } // namespace proxy |
143 } // namespace ppapi | 140 } // namespace ppapi |
OLD | NEW |