| 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/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Resource overrides. | 51 // Resource overrides. |
| 52 virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; | 52 virtual ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE; |
| 53 virtual void LastPluginRefWasDeleted() OVERRIDE; | 53 virtual void LastPluginRefWasDeleted() OVERRIDE; |
| 54 | 54 |
| 55 // PPB_ImageData API. | 55 // PPB_ImageData API. |
| 56 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; | 56 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; |
| 57 virtual void* Map() OVERRIDE; | 57 virtual void* Map() OVERRIDE; |
| 58 virtual void Unmap() OVERRIDE; | 58 virtual void Unmap() OVERRIDE; |
| 59 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; | 59 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; |
| 60 virtual skia::PlatformCanvas* GetPlatformCanvas() OVERRIDE; | 60 virtual SkCanvas* GetPlatformCanvas() OVERRIDE; |
| 61 virtual SkCanvas* GetCanvas() OVERRIDE; | 61 virtual SkCanvas* GetCanvas() OVERRIDE; |
| 62 | 62 |
| 63 const PP_ImageDataDesc& desc() const { return desc_; } | 63 const PP_ImageDataDesc& desc() const { return desc_; } |
| 64 | 64 |
| 65 void set_used_in_replace_contents() { used_in_replace_contents_ = true; } | 65 void set_used_in_replace_contents() { used_in_replace_contents_ = true; } |
| 66 | 66 |
| 67 // Prepares this image data to be recycled to the plugin. The contents will be | 67 // Prepares this image data to be recycled to the plugin. The contents will be |
| 68 // cleared if zero_contents is set. | 68 // cleared if zero_contents is set. |
| 69 void RecycleToPlugin(bool zero_contents); | 69 void RecycleToPlugin(bool zero_contents); |
| 70 | 70 |
| 71 #if !defined(OS_NACL) | 71 #if !defined(OS_NACL) |
| 72 static ImageHandle NullHandle(); | 72 static ImageHandle NullHandle(); |
| 73 static ImageHandle HandleFromInt(int32_t i); | 73 static ImageHandle HandleFromInt(int32_t i); |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 PP_ImageDataDesc desc_; | 77 PP_ImageDataDesc desc_; |
| 78 | 78 |
| 79 #if defined(OS_NACL) | 79 #if defined(OS_NACL) |
| 80 base::SharedMemory shm_; | 80 base::SharedMemory shm_; |
| 81 uint32 size_; | 81 uint32 size_; |
| 82 int map_count_; | 82 int map_count_; |
| 83 #else | 83 #else |
| 84 scoped_ptr<TransportDIB> transport_dib_; | 84 scoped_ptr<TransportDIB> transport_dib_; |
| 85 | 85 |
| 86 // Null when the image isn't mapped. | 86 // Null when the image isn't mapped. |
| 87 scoped_ptr<skia::PlatformCanvas> mapped_canvas_; | 87 scoped_ptr<SkCanvas> mapped_canvas_; |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 // Set to true when this ImageData has been used in a call to | 90 // Set to true when this ImageData has been used in a call to |
| 91 // Graphics2D.ReplaceContents. This is used to signal that it can be cached. | 91 // Graphics2D.ReplaceContents. This is used to signal that it can be cached. |
| 92 bool used_in_replace_contents_; | 92 bool used_in_replace_contents_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(ImageData); | 94 DISALLOW_COPY_AND_ASSIGN(ImageData); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 class PPB_ImageData_Proxy : public InterfaceProxy { | 97 class PPB_ImageData_Proxy : public InterfaceProxy { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Host->Plugin message handlers. | 129 // Host->Plugin message handlers. |
| 130 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); | 130 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); | 132 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } // namespace proxy | 135 } // namespace proxy |
| 136 } // namespace ppapi | 136 } // namespace ppapi |
| 137 | 137 |
| 138 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 138 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
| OLD | NEW |