Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: ppapi/proxy/ppb_image_data_proxy.h

Issue 10823378: Cache image data objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_graphics_2d_proxy.cc ('k') | ppapi/proxy/ppb_image_data_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // more consistent across platforms for NaCl, so that we can communicate to 43 // more consistent across platforms for NaCl, so that we can communicate to
44 // the host OS in a consistent way. 44 // the host OS in a consistent way.
45 ImageData(const ppapi::HostResource& resource, 45 ImageData(const ppapi::HostResource& resource,
46 const PP_ImageDataDesc& desc, 46 const PP_ImageDataDesc& desc,
47 const base::SharedMemoryHandle& handle); 47 const base::SharedMemoryHandle& handle);
48 #endif 48 #endif
49 virtual ~ImageData(); 49 virtual ~ImageData();
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 54
54 // PPB_ImageData API. 55 // PPB_ImageData API.
55 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE; 56 virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE;
56 virtual void* Map() OVERRIDE; 57 virtual void* Map() OVERRIDE;
57 virtual void Unmap() OVERRIDE; 58 virtual void Unmap() OVERRIDE;
58 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE; 59 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
59 virtual skia::PlatformCanvas* GetPlatformCanvas() OVERRIDE; 60 virtual skia::PlatformCanvas* GetPlatformCanvas() OVERRIDE;
60 virtual SkCanvas* GetCanvas() OVERRIDE; 61 virtual SkCanvas* GetCanvas() OVERRIDE;
61 62
62 const PP_ImageDataDesc& desc() const { return desc_; } 63 const PP_ImageDataDesc& desc() const { return desc_; }
63 64
65 // Fills the contents of the image with 0.
66 void ZeroContents();
67
64 #if !defined(OS_NACL) 68 #if !defined(OS_NACL)
65 static ImageHandle NullHandle(); 69 static ImageHandle NullHandle();
66 static ImageHandle HandleFromInt(int32_t i); 70 static ImageHandle HandleFromInt(int32_t i);
67 #endif 71 #endif
68 72
69 private: 73 private:
70 PP_ImageDataDesc desc_; 74 PP_ImageDataDesc desc_;
71 75
72 #if defined(OS_NACL) 76 #if defined(OS_NACL)
73 base::SharedMemory shm_; 77 base::SharedMemory shm_;
(...skipping 18 matching lines...) Expand all
92 PP_ImageDataFormat format, 96 PP_ImageDataFormat format,
93 const PP_Size& size, 97 const PP_Size& size,
94 PP_Bool init_to_zero); 98 PP_Bool init_to_zero);
95 99
96 // InterfaceProxy implementation. 100 // InterfaceProxy implementation.
97 virtual bool OnMessageReceived(const IPC::Message& msg); 101 virtual bool OnMessageReceived(const IPC::Message& msg);
98 102
99 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA; 103 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA;
100 104
101 private: 105 private:
102 // Message handlers. 106 // Plugin->Host message handlers.
103 void OnHostMsgCreate(PP_Instance instance, 107 void OnHostMsgCreate(PP_Instance instance,
104 int32_t format, 108 int32_t format,
105 const PP_Size& size, 109 const PP_Size& size,
106 PP_Bool init_to_zero, 110 PP_Bool init_to_zero,
107 HostResource* result, 111 HostResource* result,
108 std::string* image_data_desc, 112 std::string* image_data_desc,
109 ImageHandle* result_image_handle); 113 ImageHandle* result_image_handle);
110 void OnHostMsgCreateNaCl(PP_Instance instance, 114 void OnHostMsgCreateNaCl(PP_Instance instance,
111 int32_t format, 115 int32_t format,
112 const PP_Size& size, 116 const PP_Size& size,
113 PP_Bool init_to_zero, 117 PP_Bool init_to_zero,
114 HostResource* result, 118 HostResource* result,
115 std::string* image_data_desc, 119 std::string* image_data_desc,
116 base::SharedMemoryHandle* result_image_handle); 120 base::SharedMemoryHandle* result_image_handle);
117 121
122 // Host->Plugin message handlers.
123 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data);
124
118 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); 125 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy);
119 }; 126 };
120 127
121 } // namespace proxy 128 } // namespace proxy
122 } // namespace ppapi 129 } // namespace ppapi
123 130
124 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ 131 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_graphics_2d_proxy.cc ('k') | ppapi/proxy/ppb_image_data_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698