| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
| 11 #include "ppapi/c/pp_module.h" | 11 #include "ppapi/c/pp_module.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/pp_size.h" | 13 #include "ppapi/c/pp_size.h" |
| 14 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
| 15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
| 16 #include "ppapi/proxy/plugin_resource.h" |
| 16 #include "ppapi/proxy/serialized_structs.h" | 17 #include "ppapi/proxy/serialized_structs.h" |
| 18 #include "ppapi/shared_impl/image_data_impl.h" |
| 19 #include "ppapi/thunk/ppb_image_data_api.h" |
| 17 | 20 |
| 18 struct PPB_ImageData; | 21 struct PPB_ImageData; |
| 19 | 22 |
| 20 namespace pp { | 23 namespace pp { |
| 21 namespace proxy { | 24 namespace proxy { |
| 22 | 25 |
| 23 class HostResource; | 26 class HostResource; |
| 24 | 27 |
| 25 class PPB_ImageData_Proxy : public InterfaceProxy { | 28 class PPB_ImageData_Proxy : public InterfaceProxy { |
| 26 public: | 29 public: |
| 27 PPB_ImageData_Proxy(Dispatcher* dispatcher, const void* target_interface); | 30 PPB_ImageData_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 28 virtual ~PPB_ImageData_Proxy(); | 31 virtual ~PPB_ImageData_Proxy(); |
| 29 | 32 |
| 30 static const Info* GetInfo(); | 33 static const Info* GetInfo(); |
| 31 | 34 |
| 32 const PPB_ImageData* ppb_image_data_target() const { | 35 const PPB_ImageData* ppb_image_data_target() const { |
| 33 return static_cast<const PPB_ImageData*>(target_interface()); | 36 return static_cast<const PPB_ImageData*>(target_interface()); |
| 34 } | 37 } |
| 35 | 38 |
| 36 // InterfaceProxy implementation. | 39 // InterfaceProxy implementation. |
| 37 virtual bool OnMessageReceived(const IPC::Message& msg); | 40 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 41 }; |
| 42 |
| 43 class ImageData : public PluginResource, |
| 44 public ::ppapi::thunk::PPB_ImageData_API, |
| 45 public pp::shared_impl::ImageDataImpl { |
| 46 public: |
| 47 ImageData(const HostResource& resource, |
| 48 const PP_ImageDataDesc& desc, |
| 49 ImageHandle handle); |
| 50 virtual ~ImageData(); |
| 51 |
| 52 // ResourceObjectBase overrides. |
| 53 virtual ::ppapi::thunk::PPB_ImageData_API* AsImageData_API(); |
| 54 |
| 55 // Resource overrides. |
| 56 virtual ImageData* AsImageData(); |
| 57 |
| 58 // PPB_ImageData API. |
| 59 virtual PP_Bool Describe(PP_ImageDataDesc* desc); |
| 60 virtual void* Map(); |
| 61 virtual void Unmap(); |
| 62 |
| 63 const PP_ImageDataDesc& desc() const { return desc_; } |
| 64 |
| 65 static const ImageHandle NullHandle; |
| 66 static ImageHandle HandleFromInt(int32_t i); |
| 38 | 67 |
| 39 private: | 68 private: |
| 40 // Message handlers. | 69 PP_ImageDataDesc desc_; |
| 41 void OnMsgGetNativeImageDataFormat(int32* result); | 70 ImageHandle handle_; |
| 42 void OnMsgIsImageDataFormatSupported(int32 format, PP_Bool* result); | 71 |
| 43 void OnMsgCreate(PP_Instance instance, | 72 void* mapped_data_; |
| 44 int32_t format, | 73 |
| 45 const PP_Size& size, | 74 DISALLOW_COPY_AND_ASSIGN(ImageData); |
| 46 PP_Bool init_to_zero, | |
| 47 HostResource* result, | |
| 48 std::string* image_data_desc, | |
| 49 ImageHandle* result_image_handle); | |
| 50 }; | 75 }; |
| 51 | 76 |
| 52 } // namespace proxy | 77 } // namespace proxy |
| 53 } // namespace pp | 78 } // namespace pp |
| 54 | 79 |
| 55 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ | 80 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ |
| OLD | NEW |