| 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 30 matching lines...) Expand all Loading... |
| 41 public: | 41 public: |
| 42 ~ImageData() override; | 42 ~ImageData() override; |
| 43 | 43 |
| 44 // Resource overrides. | 44 // Resource overrides. |
| 45 ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() override; | 45 ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() override; |
| 46 void LastPluginRefWasDeleted() override; | 46 void LastPluginRefWasDeleted() override; |
| 47 void InstanceWasDeleted() override; | 47 void InstanceWasDeleted() override; |
| 48 | 48 |
| 49 // PPB_ImageData API. | 49 // PPB_ImageData API. |
| 50 PP_Bool Describe(PP_ImageDataDesc* desc) override; | 50 PP_Bool Describe(PP_ImageDataDesc* desc) override; |
| 51 int32_t GetSharedMemory(int* handle, uint32_t* byte_count) override; | 51 int32_t GetSharedMemory(base::SharedMemoryHandle* handle, |
| 52 uint32_t* byte_count) override; |
| 52 void SetIsCandidateForReuse() override; | 53 void SetIsCandidateForReuse() override; |
| 53 | 54 |
| 54 PPB_ImageData_Shared::ImageDataType type() const { return type_; } | 55 PPB_ImageData_Shared::ImageDataType type() const { return type_; } |
| 55 const PP_ImageDataDesc& desc() const { return desc_; } | 56 const PP_ImageDataDesc& desc() const { return desc_; } |
| 56 | 57 |
| 57 // Prepares this image data to be recycled to the plugin. Clears the contents | 58 // Prepares this image data to be recycled to the plugin. Clears the contents |
| 58 // if zero_contents is true. | 59 // if zero_contents is true. |
| 59 void RecycleToPlugin(bool zero_contents); | 60 void RecycleToPlugin(bool zero_contents); |
| 60 | 61 |
| 61 protected: | 62 protected: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // |image_handle| and |byte_count| contain the result of GetSharedMemory. | 150 // |image_handle| and |byte_count| contain the result of GetSharedMemory. |
| 150 // NOTE: if |init_to_zero| is false, you should write over the entire image | 151 // NOTE: if |init_to_zero| is false, you should write over the entire image |
| 151 // to avoid leaking sensitive data to a less privileged process. | 152 // to avoid leaking sensitive data to a less privileged process. |
| 152 PPAPI_PROXY_EXPORT static PP_Resource CreateImageData( | 153 PPAPI_PROXY_EXPORT static PP_Resource CreateImageData( |
| 153 PP_Instance instance, | 154 PP_Instance instance, |
| 154 PPB_ImageData_Shared::ImageDataType type, | 155 PPB_ImageData_Shared::ImageDataType type, |
| 155 PP_ImageDataFormat format, | 156 PP_ImageDataFormat format, |
| 156 const PP_Size& size, | 157 const PP_Size& size, |
| 157 bool init_to_zero, | 158 bool init_to_zero, |
| 158 PP_ImageDataDesc* desc, | 159 PP_ImageDataDesc* desc, |
| 159 IPC::PlatformFileForTransit* image_handle, | 160 base::SharedMemoryHandle* image_handle, |
| 160 uint32_t* byte_count); | 161 uint32_t* byte_count); |
| 161 | 162 |
| 162 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA; | 163 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA; |
| 163 | 164 |
| 164 private: | 165 private: |
| 165 // Plugin->Host message handlers. | 166 // Plugin->Host message handlers. |
| 166 void OnHostMsgCreatePlatform( | 167 void OnHostMsgCreatePlatform( |
| 167 PP_Instance instance, | 168 PP_Instance instance, |
| 168 int32_t format, | 169 int32_t format, |
| 169 const PP_Size& size, | 170 const PP_Size& size, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 183 // Host->Plugin message handlers. | 184 // Host->Plugin message handlers. |
| 184 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); | 185 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); |
| 185 | 186 |
| 186 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); | 187 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); |
| 187 }; | 188 }; |
| 188 | 189 |
| 189 } // namespace proxy | 190 } // namespace proxy |
| 190 } // namespace ppapi | 191 } // namespace ppapi |
| 191 | 192 |
| 192 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 193 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
| OLD | NEW |