OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // resources, ImageData must be public in the header since a number of other | 35 // resources, ImageData must be public in the header since a number of other |
36 // resources need to access it. | 36 // resources need to access it. |
37 class PPAPI_PROXY_EXPORT ImageData | 37 class PPAPI_PROXY_EXPORT ImageData |
38 : public ppapi::Resource, | 38 : public ppapi::Resource, |
39 public NON_EXPORTED_BASE(ppapi::thunk::PPB_ImageData_API), | 39 public NON_EXPORTED_BASE(ppapi::thunk::PPB_ImageData_API), |
40 public ppapi::PPB_ImageData_Shared { | 40 public ppapi::PPB_ImageData_Shared { |
41 public: | 41 public: |
42 virtual ~ImageData(); | 42 virtual ~ImageData(); |
43 | 43 |
44 // Resource overrides. | 44 // Resource overrides. |
45 virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; | 45 virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() override; |
46 virtual void LastPluginRefWasDeleted() OVERRIDE; | 46 virtual void LastPluginRefWasDeleted() override; |
47 virtual void InstanceWasDeleted() OVERRIDE; | 47 virtual void InstanceWasDeleted() override; |
48 | 48 |
49 // PPB_ImageData API. | 49 // PPB_ImageData API. |
50 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; | 50 virtual PP_Bool Describe(PP_ImageDataDesc* desc) override; |
51 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; | 51 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) override; |
52 virtual void SetIsCandidateForReuse() OVERRIDE; | 52 virtual void SetIsCandidateForReuse() override; |
53 | 53 |
54 PPB_ImageData_Shared::ImageDataType type() const { return type_; } | 54 PPB_ImageData_Shared::ImageDataType type() const { return type_; } |
55 const PP_ImageDataDesc& desc() const { return desc_; } | 55 const PP_ImageDataDesc& desc() const { return desc_; } |
56 | 56 |
57 // Prepares this image data to be recycled to the plugin. Clears the contents | 57 // Prepares this image data to be recycled to the plugin. Clears the contents |
58 // if zero_contents is true. | 58 // if zero_contents is true. |
59 void RecycleToPlugin(bool zero_contents); | 59 void RecycleToPlugin(bool zero_contents); |
60 | 60 |
61 protected: | 61 protected: |
62 ImageData(const ppapi::HostResource& resource, | 62 ImageData(const ppapi::HostResource& resource, |
(...skipping 14 matching lines...) Expand all Loading... |
77 // by NaCl apps. | 77 // by NaCl apps. |
78 #if !defined(OS_NACL) | 78 #if !defined(OS_NACL) |
79 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { | 79 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { |
80 public: | 80 public: |
81 PlatformImageData(const ppapi::HostResource& resource, | 81 PlatformImageData(const ppapi::HostResource& resource, |
82 const PP_ImageDataDesc& desc, | 82 const PP_ImageDataDesc& desc, |
83 ImageHandle handle); | 83 ImageHandle handle); |
84 virtual ~PlatformImageData(); | 84 virtual ~PlatformImageData(); |
85 | 85 |
86 // PPB_ImageData API. | 86 // PPB_ImageData API. |
87 virtual void* Map() OVERRIDE; | 87 virtual void* Map() override; |
88 virtual void Unmap() OVERRIDE; | 88 virtual void Unmap() override; |
89 virtual SkCanvas* GetPlatformCanvas() OVERRIDE; | 89 virtual SkCanvas* GetPlatformCanvas() override; |
90 virtual SkCanvas* GetCanvas() OVERRIDE; | 90 virtual SkCanvas* GetCanvas() override; |
91 | 91 |
92 static ImageHandle NullHandle(); | 92 static ImageHandle NullHandle(); |
93 static ImageHandle HandleFromInt(int32_t i); | 93 static ImageHandle HandleFromInt(int32_t i); |
94 | 94 |
95 private: | 95 private: |
96 scoped_ptr<TransportDIB> transport_dib_; | 96 scoped_ptr<TransportDIB> transport_dib_; |
97 | 97 |
98 // Null when the image isn't mapped. | 98 // Null when the image isn't mapped. |
99 scoped_ptr<SkCanvas> mapped_canvas_; | 99 scoped_ptr<SkCanvas> mapped_canvas_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); | 101 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); |
102 }; | 102 }; |
103 #endif // !defined(OS_NACL) | 103 #endif // !defined(OS_NACL) |
104 | 104 |
105 // SimpleImageData is a simple, platform-independent image data resource which | 105 // SimpleImageData is a simple, platform-independent image data resource which |
106 // can be used by NaCl. It can also be used by trusted apps when access to the | 106 // can be used by NaCl. It can also be used by trusted apps when access to the |
107 // platform canvas isn't needed. | 107 // platform canvas isn't needed. |
108 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { | 108 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { |
109 public: | 109 public: |
110 SimpleImageData(const ppapi::HostResource& resource, | 110 SimpleImageData(const ppapi::HostResource& resource, |
111 const PP_ImageDataDesc& desc, | 111 const PP_ImageDataDesc& desc, |
112 const base::SharedMemoryHandle& handle); | 112 const base::SharedMemoryHandle& handle); |
113 virtual ~SimpleImageData(); | 113 virtual ~SimpleImageData(); |
114 | 114 |
115 // PPB_ImageData API. | 115 // PPB_ImageData API. |
116 virtual void* Map() OVERRIDE; | 116 virtual void* Map() override; |
117 virtual void Unmap() OVERRIDE; | 117 virtual void Unmap() override; |
118 virtual SkCanvas* GetPlatformCanvas() OVERRIDE; | 118 virtual SkCanvas* GetPlatformCanvas() override; |
119 virtual SkCanvas* GetCanvas() OVERRIDE; | 119 virtual SkCanvas* GetCanvas() override; |
120 | 120 |
121 private: | 121 private: |
122 base::SharedMemory shm_; | 122 base::SharedMemory shm_; |
123 uint32 size_; | 123 uint32 size_; |
124 int map_count_; | 124 int map_count_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); | 126 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); |
127 }; | 127 }; |
128 | 128 |
129 class PPB_ImageData_Proxy : public InterfaceProxy { | 129 class PPB_ImageData_Proxy : public InterfaceProxy { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Host->Plugin message handlers. | 183 // Host->Plugin message handlers. |
184 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); | 184 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); | 186 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace proxy | 189 } // namespace proxy |
190 } // namespace ppapi | 190 } // namespace ppapi |
191 | 191 |
192 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 192 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
OLD | NEW |