| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { | 88 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { |
| 89 public: | 89 public: |
| 90 PlatformImageData(const ppapi::HostResource& resource, | 90 PlatformImageData(const ppapi::HostResource& resource, |
| 91 const PP_ImageDataDesc& desc, | 91 const PP_ImageDataDesc& desc, |
| 92 ImageHandle handle); | 92 ImageHandle handle); |
| 93 ~PlatformImageData() override; | 93 ~PlatformImageData() override; |
| 94 | 94 |
| 95 // PPB_ImageData API. | 95 // PPB_ImageData API. |
| 96 void* Map() override; | 96 void* Map() override; |
| 97 void Unmap() override; | 97 void Unmap() override; |
| 98 SkCanvas* GetPlatformCanvas() override; | |
| 99 SkCanvas* GetCanvas() override; | 98 SkCanvas* GetCanvas() override; |
| 100 | 99 |
| 101 static ImageHandle NullHandle(); | 100 static ImageHandle NullHandle(); |
| 102 | 101 |
| 103 private: | 102 private: |
| 104 std::unique_ptr<TransportDIB> transport_dib_; | 103 std::unique_ptr<TransportDIB> transport_dib_; |
| 105 | 104 |
| 106 // Null when the image isn't mapped. | 105 // Null when the image isn't mapped. |
| 107 std::unique_ptr<SkCanvas> mapped_canvas_; | 106 std::unique_ptr<SkCanvas> mapped_canvas_; |
| 108 | 107 |
| 109 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); | 108 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); |
| 110 }; | 109 }; |
| 111 #endif // !defined(OS_NACL) | 110 #endif // !defined(OS_NACL) |
| 112 | 111 |
| 113 // SimpleImageData is a simple, platform-independent image data resource which | 112 // SimpleImageData is a simple, platform-independent image data resource which |
| 114 // can be used by NaCl. It can also be used by trusted apps when access to the | 113 // can be used by NaCl. It can also be used by trusted apps when access to the |
| 115 // platform canvas isn't needed. | 114 // platform canvas isn't needed. |
| 116 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { | 115 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { |
| 117 public: | 116 public: |
| 118 SimpleImageData(const ppapi::HostResource& resource, | 117 SimpleImageData(const ppapi::HostResource& resource, |
| 119 const PP_ImageDataDesc& desc, | 118 const PP_ImageDataDesc& desc, |
| 120 const base::SharedMemoryHandle& handle); | 119 const base::SharedMemoryHandle& handle); |
| 121 ~SimpleImageData() override; | 120 ~SimpleImageData() override; |
| 122 | 121 |
| 123 // PPB_ImageData API. | 122 // PPB_ImageData API. |
| 124 void* Map() override; | 123 void* Map() override; |
| 125 void Unmap() override; | 124 void Unmap() override; |
| 126 SkCanvas* GetPlatformCanvas() override; | |
| 127 SkCanvas* GetCanvas() override; | 125 SkCanvas* GetCanvas() override; |
| 128 | 126 |
| 129 private: | 127 private: |
| 130 base::SharedMemory shm_; | 128 base::SharedMemory shm_; |
| 131 uint32_t size_; | 129 uint32_t size_; |
| 132 int map_count_; | 130 int map_count_; |
| 133 | 131 |
| 134 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); | 132 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); |
| 135 }; | 133 }; |
| 136 | 134 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Host->Plugin message handlers. | 189 // Host->Plugin message handlers. |
| 192 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); | 190 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); |
| 193 | 191 |
| 194 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); | 192 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); |
| 195 }; | 193 }; |
| 196 | 194 |
| 197 } // namespace proxy | 195 } // namespace proxy |
| 198 } // namespace ppapi | 196 } // namespace ppapi |
| 199 | 197 |
| 200 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 198 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
| OLD | NEW |