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

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

Issue 10880033: Don't overwrit image data case entries that are just marked usable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 skia::PlatformCanvas* 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 // Fills the contents of the image with 0. 65 void set_used_in_replace_contents() { used_in_replace_contents_ = true; }
66 void ZeroContents(); 66
67 // Prepares this image data to be recycled to the plugin. The contents will be
68 // cleared if zero_contents is set.
69 void RecycleToPlugin(bool zero_contents);
67 70
68 #if !defined(OS_NACL) 71 #if !defined(OS_NACL)
69 static ImageHandle NullHandle(); 72 static ImageHandle NullHandle();
70 static ImageHandle HandleFromInt(int32_t i); 73 static ImageHandle HandleFromInt(int32_t i);
71 #endif 74 #endif
72 75
73 private: 76 private:
74 PP_ImageDataDesc desc_; 77 PP_ImageDataDesc desc_;
75 78
76 #if defined(OS_NACL) 79 #if defined(OS_NACL)
77 base::SharedMemory shm_; 80 base::SharedMemory shm_;
78 uint32 size_; 81 uint32 size_;
79 int map_count_; 82 int map_count_;
80 #else 83 #else
81 scoped_ptr<TransportDIB> transport_dib_; 84 scoped_ptr<TransportDIB> transport_dib_;
82 85
83 // Null when the image isn't mapped. 86 // Null when the image isn't mapped.
84 scoped_ptr<skia::PlatformCanvas> mapped_canvas_; 87 scoped_ptr<skia::PlatformCanvas> mapped_canvas_;
85 #endif 88 #endif
86 89
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.
92 bool used_in_replace_contents_;
93
87 DISALLOW_COPY_AND_ASSIGN(ImageData); 94 DISALLOW_COPY_AND_ASSIGN(ImageData);
88 }; 95 };
89 96
90 class PPB_ImageData_Proxy : public InterfaceProxy { 97 class PPB_ImageData_Proxy : public InterfaceProxy {
91 public: 98 public:
92 PPB_ImageData_Proxy(Dispatcher* dispatcher); 99 PPB_ImageData_Proxy(Dispatcher* dispatcher);
93 virtual ~PPB_ImageData_Proxy(); 100 virtual ~PPB_ImageData_Proxy();
94 101
95 static PP_Resource CreateProxyResource(PP_Instance instance, 102 static PP_Resource CreateProxyResource(PP_Instance instance,
96 PP_ImageDataFormat format, 103 PP_ImageDataFormat format,
(...skipping 25 matching lines...) Expand all
122 // Host->Plugin message handlers. 129 // Host->Plugin message handlers.
123 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); 130 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data);
124 131
125 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); 132 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy);
126 }; 133 };
127 134
128 } // namespace proxy 135 } // namespace proxy
129 } // namespace ppapi 136 } // namespace ppapi
130 137
131 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ 138 #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