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

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

Issue 7623018: Move host resource from the proxy to the shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 9 years, 4 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_graphics_3d_proxy.cc ('k') | ppapi/proxy/ppb_image_data_proxy.cc » ('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 #ifndef PPAPI_PPB_IMAGE_DATA_PROXY_H_ 5 #ifndef PPAPI_PPB_IMAGE_DATA_PROXY_H_
6 #define PPAPI_PPB_IMAGE_DATA_PROXY_H_ 6 #define PPAPI_PPB_IMAGE_DATA_PROXY_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_instance.h" 10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_module.h" 11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_size.h" 13 #include "ppapi/c/pp_size.h"
14 #include "ppapi/c/pp_var.h" 14 #include "ppapi/c/pp_var.h"
15 #include "ppapi/proxy/interface_proxy.h" 15 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/plugin_resource.h" 16 #include "ppapi/proxy/plugin_resource.h"
17 #include "ppapi/proxy/serialized_structs.h" 17 #include "ppapi/proxy/serialized_structs.h"
18 #include "ppapi/shared_impl/image_data_impl.h" 18 #include "ppapi/shared_impl/image_data_impl.h"
19 #include "ppapi/thunk/ppb_image_data_api.h" 19 #include "ppapi/thunk/ppb_image_data_api.h"
20 20
21 struct PPB_ImageData; 21 struct PPB_ImageData;
22 class TransportDIB; 22 class TransportDIB;
23 23
24 namespace ppapi {
25 class HostResource;
26 }
27
24 namespace skia { 28 namespace skia {
25 class PlatformCanvas; 29 class PlatformCanvas;
26 } 30 }
27 31
28 namespace pp { 32 namespace pp {
29 namespace proxy { 33 namespace proxy {
30 34
31 class HostResource;
32
33 class PPB_ImageData_Proxy : public InterfaceProxy { 35 class PPB_ImageData_Proxy : public InterfaceProxy {
34 public: 36 public:
35 PPB_ImageData_Proxy(Dispatcher* dispatcher, const void* target_interface); 37 PPB_ImageData_Proxy(Dispatcher* dispatcher, const void* target_interface);
36 virtual ~PPB_ImageData_Proxy(); 38 virtual ~PPB_ImageData_Proxy();
37 39
38 static const Info* GetInfo(); 40 static const Info* GetInfo();
39 41
40 const PPB_ImageData* ppb_image_data_target() const { 42 const PPB_ImageData* ppb_image_data_target() const {
41 return static_cast<const PPB_ImageData*>(target_interface()); 43 return static_cast<const PPB_ImageData*>(target_interface());
42 } 44 }
43 45
44 // InterfaceProxy implementation. 46 // InterfaceProxy implementation.
45 virtual bool OnMessageReceived(const IPC::Message& msg); 47 virtual bool OnMessageReceived(const IPC::Message& msg);
46 }; 48 };
47 49
48 class ImageData : public PluginResource, 50 class ImageData : public PluginResource,
49 public ::ppapi::thunk::PPB_ImageData_API, 51 public ::ppapi::thunk::PPB_ImageData_API,
50 public ppapi::ImageDataImpl { 52 public ppapi::ImageDataImpl {
51 public: 53 public:
52 ImageData(const HostResource& resource, 54 ImageData(const ppapi::HostResource& resource,
53 const PP_ImageDataDesc& desc, 55 const PP_ImageDataDesc& desc,
54 ImageHandle handle); 56 ImageHandle handle);
55 virtual ~ImageData(); 57 virtual ~ImageData();
56 58
57 // ResourceObjectBase overrides. 59 // ResourceObjectBase overrides.
58 virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; 60 virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE;
59 61
60 // Resource overrides.
61 virtual ImageData* AsImageData() OVERRIDE;
62
63 // PPB_ImageData API. 62 // PPB_ImageData API.
64 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; 63 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE;
65 virtual void* Map() OVERRIDE; 64 virtual void* Map() OVERRIDE;
66 virtual void Unmap() OVERRIDE; 65 virtual void Unmap() OVERRIDE;
67 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; 66 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
68 67
69 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } 68 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); }
70 69
71 const PP_ImageDataDesc& desc() const { return desc_; } 70 const PP_ImageDataDesc& desc() const { return desc_; }
72 71
73 static const ImageHandle NullHandle; 72 static const ImageHandle NullHandle;
74 static ImageHandle HandleFromInt(int32_t i); 73 static ImageHandle HandleFromInt(int32_t i);
75 74
76 private: 75 private:
77 PP_ImageDataDesc desc_; 76 PP_ImageDataDesc desc_;
78 77
79 scoped_ptr<TransportDIB> transport_dib_; 78 scoped_ptr<TransportDIB> transport_dib_;
80 79
81 // Null when the image isn't mapped. 80 // Null when the image isn't mapped.
82 scoped_ptr<skia::PlatformCanvas> mapped_canvas_; 81 scoped_ptr<skia::PlatformCanvas> mapped_canvas_;
83 82
84 DISALLOW_COPY_AND_ASSIGN(ImageData); 83 DISALLOW_COPY_AND_ASSIGN(ImageData);
85 }; 84 };
86 85
87 } // namespace proxy 86 } // namespace proxy
88 } // namespace pp 87 } // namespace pp
89 88
90 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ 89 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_graphics_3d_proxy.cc ('k') | ppapi/proxy/ppb_image_data_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698