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

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

Issue 7874002: This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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/ppb_url_loader_proxy.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_tracker.h" 10 #include "ppapi/proxy/plugin_resource_tracker.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const void* target_interface) { 79 return new PPB_Testing_Proxy(dispatcher);
80 return new PPB_Testing_Proxy(dispatcher, target_interface);
81 } 80 }
82 81
83 } // namespace 82 } // namespace
84 83
85 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher, 84 PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher)
86 const void* target_interface) 85 : InterfaceProxy(dispatcher),
87 : InterfaceProxy(dispatcher, target_interface) { 86 ppb_testing_impl_(NULL) {
87 if (!dispatcher->IsPlugin()) {
88 ppb_testing_impl_ = static_cast<const PPB_Testing_Dev*>(
89 dispatcher->local_get_interface()(PPB_TESTING_DEV_INTERFACE));
90 }
88 } 91 }
89 92
90 PPB_Testing_Proxy::~PPB_Testing_Proxy() { 93 PPB_Testing_Proxy::~PPB_Testing_Proxy() {
91 } 94 }
92 95
93 // static 96 // static
94 const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() { 97 const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() {
95 static const Info info = { 98 static const Info info = {
96 &testing_interface, 99 &testing_interface,
97 PPB_TESTING_DEV_INTERFACE, 100 PPB_TESTING_DEV_INTERFACE,
(...skipping 14 matching lines...) Expand all
112 IPC_MESSAGE_UNHANDLED(handled = false) 115 IPC_MESSAGE_UNHANDLED(handled = false)
113 IPC_END_MESSAGE_MAP() 116 IPC_END_MESSAGE_MAP()
114 return handled; 117 return handled;
115 } 118 }
116 119
117 void PPB_Testing_Proxy::OnMsgReadImageData( 120 void PPB_Testing_Proxy::OnMsgReadImageData(
118 const HostResource& device_context_2d, 121 const HostResource& device_context_2d,
119 const HostResource& image, 122 const HostResource& image,
120 const PP_Point& top_left, 123 const PP_Point& top_left,
121 PP_Bool* result) { 124 PP_Bool* result) {
122 *result = ppb_testing_target()->ReadImageData( 125 *result = ppb_testing_impl_->ReadImageData(
123 device_context_2d.host_resource(), image.host_resource(), &top_left); 126 device_context_2d.host_resource(), image.host_resource(), &top_left);
124 } 127 }
125 128
126 void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) { 129 void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
127 ppb_testing_target()->RunMessageLoop(instance); 130 ppb_testing_impl_->RunMessageLoop(instance);
128 } 131 }
129 132
130 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { 133 void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
131 ppb_testing_target()->QuitMessageLoop(instance); 134 ppb_testing_impl_->QuitMessageLoop(instance);
132 } 135 }
133 136
134 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance, 137 void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance,
135 uint32_t* result) { 138 uint32_t* result) {
136 *result = ppb_testing_target()->GetLiveObjectsForInstance(instance); 139 *result = ppb_testing_impl_->GetLiveObjectsForInstance(instance);
137 } 140 }
138 141
139 } // namespace proxy 142 } // namespace proxy
140 } // namespace ppapi 143 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.h ('k') | ppapi/proxy/ppb_url_loader_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698