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

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

Issue 6286070: Remove all uses of the global Dispatcher Get function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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_image_data_proxy.h ('k') | ppapi/proxy/ppb_instance_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_image_data_proxy.h" 5 #include "ppapi/proxy/ppb_image_data_proxy.h"
6 6
7 #include <string.h> // For memcpy 7 #include <string.h> // For memcpy
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return NULL; 191 return NULL;
192 return object->Map(); 192 return object->Map();
193 } 193 }
194 194
195 void Unmap(PP_Resource resource) { 195 void Unmap(PP_Resource resource) {
196 ImageData* object = PluginResource::GetAs<ImageData>(resource); 196 ImageData* object = PluginResource::GetAs<ImageData>(resource);
197 if (object) 197 if (object)
198 object->Unmap(); 198 object->Unmap();
199 } 199 }
200 200
201 const PPB_ImageData ppb_imagedata = { 201 const PPB_ImageData image_data_interface = {
202 &GetNativeImageDataFormat, 202 &GetNativeImageDataFormat,
203 &IsImageDataFormatSupported, 203 &IsImageDataFormatSupported,
204 &Create, 204 &Create,
205 &IsImageData, 205 &IsImageData,
206 &Describe, 206 &Describe,
207 &Map, 207 &Map,
208 &Unmap, 208 &Unmap,
209 }; 209 };
210 210
211 InterfaceProxy* CreateImageDataProxy(Dispatcher* dispatcher,
212 const void* target_interface) {
213 return new PPB_ImageData_Proxy(dispatcher, target_interface);
214 }
215
211 } // namespace 216 } // namespace
212 217
213 PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher, 218 PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher,
214 const void* target_interface) 219 const void* target_interface)
215 : InterfaceProxy(dispatcher, target_interface) { 220 : InterfaceProxy(dispatcher, target_interface) {
216 } 221 }
217 222
218 PPB_ImageData_Proxy::~PPB_ImageData_Proxy() { 223 PPB_ImageData_Proxy::~PPB_ImageData_Proxy() {
219 } 224 }
220 225
221 const void* PPB_ImageData_Proxy::GetSourceInterface() const { 226 // static
222 return &ppb_imagedata; 227 const InterfaceProxy::Info* PPB_ImageData_Proxy::GetInfo() {
223 } 228 static const Info info = {
224 229 &image_data_interface,
225 InterfaceID PPB_ImageData_Proxy::GetInterfaceId() const { 230 PPB_IMAGEDATA_INTERFACE,
226 return INTERFACE_ID_PPB_IMAGE_DATA; 231 INTERFACE_ID_PPB_IMAGE_DATA,
232 false,
233 &CreateImageDataProxy,
234 };
235 return &info;
227 } 236 }
228 237
229 bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { 238 bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) {
230 bool handled = true; 239 bool handled = true;
231 IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg) 240 IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg)
232 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnMsgCreate) 241 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnMsgCreate)
233 IPC_MESSAGE_UNHANDLED(handled = false) 242 IPC_MESSAGE_UNHANDLED(handled = false)
234 IPC_END_MESSAGE_MAP() 243 IPC_END_MESSAGE_MAP()
235 // FIXME(brettw) handle bad messages! 244 // FIXME(brettw) handle bad messages!
236 return handled; 245 return handled;
(...skipping 27 matching lines...) Expand all
264 if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK) 273 if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK)
265 *result_image_handle = ImageData::HandleFromInt(handle); 274 *result_image_handle = ImageData::HandleFromInt(handle);
266 } 275 }
267 276
268 result->SetHostResource(instance, resource); 277 result->SetHostResource(instance, resource);
269 } 278 }
270 } 279 }
271 280
272 } // namespace proxy 281 } // namespace proxy
273 } // namespace pp 282 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.h ('k') | ppapi/proxy/ppb_instance_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698