| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 16 #include "ppapi/c/pp_bool.h" | 16 #include "ppapi/c/pp_bool.h" |
| 17 #include "ppapi/c/pp_completion_callback.h" | 17 #include "ppapi/c/pp_completion_callback.h" |
| 18 #include "ppapi/c/pp_instance.h" | 18 #include "ppapi/c/pp_instance.h" |
| 19 #include "ppapi/c/pp_module.h" | 19 #include "ppapi/c/pp_module.h" |
| 20 #include "ppapi/c/pp_resource.h" | 20 #include "ppapi/c/pp_resource.h" |
| 21 #include "ppapi/c/pp_size.h" | 21 #include "ppapi/c/pp_size.h" |
| 22 #include "ppapi/c/pp_var.h" | 22 #include "ppapi/c/pp_var.h" |
| 23 #include "ppapi/c/ppb_image_data.h" | 23 #include "ppapi/c/ppb_image_data.h" |
| 24 #include "ppapi/proxy/interface_proxy.h" | 24 #include "ppapi/proxy/interface_proxy.h" |
| 25 #include "ppapi/proxy/ppapi_proxy_export.h" | 25 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 26 #include "ppapi/proxy/serialized_structs.h" | 26 #include "ppapi/proxy/serialized_structs.h" |
| 27 #include "ppapi/shared_impl/ppb_image_data_shared.h" | 27 #include "ppapi/shared_impl/ppb_image_data_shared.h" |
| 28 #include "ppapi/shared_impl/resource.h" | 28 #include "ppapi/shared_impl/resource.h" |
| 29 #include "ppapi/thunk/ppb_image_data_api.h" | 29 #include "ppapi/thunk/ppb_image_data_api.h" |
| 30 #include "skia/ext/cdl_common.h" |
| 30 | 31 |
| 31 #if !defined(OS_NACL) | 32 #if !defined(OS_NACL) |
| 32 #include "third_party/skia/include/core/SkRefCnt.h" | 33 #include "third_party/skia/include/core/SkRefCnt.h" |
| 33 #endif // !defined(OS_NACL) | 34 #endif // !defined(OS_NACL) |
| 34 | 35 |
| 35 class TransportDIB; | 36 class TransportDIB; |
| 36 | 37 |
| 37 namespace ppapi { | 38 namespace ppapi { |
| 38 namespace proxy { | 39 namespace proxy { |
| 39 | 40 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { | 89 class PPAPI_PROXY_EXPORT PlatformImageData : public ImageData { |
| 89 public: | 90 public: |
| 90 PlatformImageData(const ppapi::HostResource& resource, | 91 PlatformImageData(const ppapi::HostResource& resource, |
| 91 const PP_ImageDataDesc& desc, | 92 const PP_ImageDataDesc& desc, |
| 92 ImageHandle handle); | 93 ImageHandle handle); |
| 93 ~PlatformImageData() override; | 94 ~PlatformImageData() override; |
| 94 | 95 |
| 95 // PPB_ImageData API. | 96 // PPB_ImageData API. |
| 96 void* Map() override; | 97 void* Map() override; |
| 97 void Unmap() override; | 98 void Unmap() override; |
| 98 SkCanvas* GetPlatformCanvas() override; | 99 CdlCanvas* GetPlatformCanvas() override; |
| 99 SkCanvas* GetCanvas() override; | 100 CdlCanvas* GetCanvas() override; |
| 100 | 101 |
| 101 static ImageHandle NullHandle(); | 102 static ImageHandle NullHandle(); |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 std::unique_ptr<TransportDIB> transport_dib_; | 105 std::unique_ptr<TransportDIB> transport_dib_; |
| 105 | 106 |
| 106 // Null when the image isn't mapped. | 107 // Null when the image isn't mapped. |
| 107 std::unique_ptr<SkCanvas> mapped_canvas_; | 108 std::unique_ptr<CdlCanvas> mapped_canvas_; |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); | 110 DISALLOW_COPY_AND_ASSIGN(PlatformImageData); |
| 110 }; | 111 }; |
| 111 #endif // !defined(OS_NACL) | 112 #endif // !defined(OS_NACL) |
| 112 | 113 |
| 113 // SimpleImageData is a simple, platform-independent image data resource which | 114 // 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 | 115 // can be used by NaCl. It can also be used by trusted apps when access to the |
| 115 // platform canvas isn't needed. | 116 // platform canvas isn't needed. |
| 116 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { | 117 class PPAPI_PROXY_EXPORT SimpleImageData : public ImageData { |
| 117 public: | 118 public: |
| 118 SimpleImageData(const ppapi::HostResource& resource, | 119 SimpleImageData(const ppapi::HostResource& resource, |
| 119 const PP_ImageDataDesc& desc, | 120 const PP_ImageDataDesc& desc, |
| 120 const base::SharedMemoryHandle& handle); | 121 const base::SharedMemoryHandle& handle); |
| 121 ~SimpleImageData() override; | 122 ~SimpleImageData() override; |
| 122 | 123 |
| 123 // PPB_ImageData API. | 124 // PPB_ImageData API. |
| 124 void* Map() override; | 125 void* Map() override; |
| 125 void Unmap() override; | 126 void Unmap() override; |
| 126 SkCanvas* GetPlatformCanvas() override; | 127 CdlCanvas* GetPlatformCanvas() override; |
| 127 SkCanvas* GetCanvas() override; | 128 CdlCanvas* GetCanvas() override; |
| 128 | 129 |
| 129 private: | 130 private: |
| 130 base::SharedMemory shm_; | 131 base::SharedMemory shm_; |
| 131 uint32_t size_; | 132 uint32_t size_; |
| 132 int map_count_; | 133 int map_count_; |
| 133 | 134 |
| 134 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); | 135 DISALLOW_COPY_AND_ASSIGN(SimpleImageData); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 class PPB_ImageData_Proxy : public InterfaceProxy { | 138 class PPB_ImageData_Proxy : public InterfaceProxy { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Host->Plugin message handlers. | 192 // Host->Plugin message handlers. |
| 192 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); | 193 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); |
| 193 | 194 |
| 194 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); | 195 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); |
| 195 }; | 196 }; |
| 196 | 197 |
| 197 } // namespace proxy | 198 } // namespace proxy |
| 198 } // namespace ppapi | 199 } // namespace ppapi |
| 199 | 200 |
| 200 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 201 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
| OLD | NEW |