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

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

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments 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
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 "base/scoped_ptr.h"
8 #include "ppapi/c/pp_bool.h" 9 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_completion_callback.h" 10 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_instance.h" 11 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_module.h" 12 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/pp_resource.h" 13 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_size.h" 14 #include "ppapi/c/pp_size.h"
14 #include "ppapi/c/pp_var.h" 15 #include "ppapi/c/pp_var.h"
15 #include "ppapi/proxy/interface_proxy.h" 16 #include "ppapi/proxy/interface_proxy.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/shared_impl/resource.h"
19 #include "ppapi/thunk/ppb_image_data_api.h" 20 #include "ppapi/thunk/ppb_image_data_api.h"
20 21
21 struct PPB_ImageData; 22 struct PPB_ImageData;
22 class TransportDIB; 23 class TransportDIB;
23 24
24 namespace ppapi { 25 namespace ppapi {
25 class HostResource; 26 class HostResource;
26 } 27 }
27 28
28 namespace skia { 29 namespace skia {
(...skipping 11 matching lines...) Expand all
40 static const Info* GetInfo(); 41 static const Info* GetInfo();
41 42
42 const PPB_ImageData* ppb_image_data_target() const { 43 const PPB_ImageData* ppb_image_data_target() const {
43 return static_cast<const PPB_ImageData*>(target_interface()); 44 return static_cast<const PPB_ImageData*>(target_interface());
44 } 45 }
45 46
46 // InterfaceProxy implementation. 47 // InterfaceProxy implementation.
47 virtual bool OnMessageReceived(const IPC::Message& msg); 48 virtual bool OnMessageReceived(const IPC::Message& msg);
48 }; 49 };
49 50
50 class ImageData : public PluginResource, 51 class ImageData : public ppapi::Resource,
51 public ::ppapi::thunk::PPB_ImageData_API, 52 public ppapi::thunk::PPB_ImageData_API,
52 public ppapi::ImageDataImpl { 53 public ppapi::ImageDataImpl {
53 public: 54 public:
54 ImageData(const ppapi::HostResource& resource, 55 ImageData(const ppapi::HostResource& resource,
55 const PP_ImageDataDesc& desc, 56 const PP_ImageDataDesc& desc,
56 ImageHandle handle); 57 ImageHandle handle);
57 virtual ~ImageData(); 58 virtual ~ImageData();
58 59
59 // ResourceObjectBase overrides. 60 // Resource overrides.
60 virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; 61 virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE;
61 62
62 // PPB_ImageData API. 63 // PPB_ImageData API.
63 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; 64 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE;
64 virtual void* Map() OVERRIDE; 65 virtual void* Map() OVERRIDE;
65 virtual void Unmap() OVERRIDE; 66 virtual void Unmap() OVERRIDE;
66 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; 67 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
67 68
68 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } 69 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); }
69 70
70 const PP_ImageDataDesc& desc() const { return desc_; } 71 const PP_ImageDataDesc& desc() const { return desc_; }
71 72
72 static const ImageHandle NullHandle; 73 static const ImageHandle NullHandle;
73 static ImageHandle HandleFromInt(int32_t i); 74 static ImageHandle HandleFromInt(int32_t i);
74 75
75 private: 76 private:
76 PP_ImageDataDesc desc_; 77 PP_ImageDataDesc desc_;
77 78
78 scoped_ptr<TransportDIB> transport_dib_; 79 scoped_ptr<TransportDIB> transport_dib_;
79 80
80 // Null when the image isn't mapped. 81 // Null when the image isn't mapped.
81 scoped_ptr<skia::PlatformCanvas> mapped_canvas_; 82 scoped_ptr<skia::PlatformCanvas> mapped_canvas_;
82 83
83 DISALLOW_COPY_AND_ASSIGN(ImageData); 84 DISALLOW_COPY_AND_ASSIGN(ImageData);
84 }; 85 };
85 86
86 } // namespace proxy 87 } // namespace proxy
87 } // namespace pp 88 } // namespace pp
88 89
89 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ 90 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698