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

Side by Side Diff: webkit/glue/plugins/pepper_image_data.cc

Issue 4611001: Change the private image data shared memory handle code to return a native... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « webkit/glue/plugins/pepper_image_data.h ('k') | webkit/glue/plugins/pepper_plugin_delegate.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "webkit/glue/plugins/pepper_image_data.h" 5 #include "webkit/glue/plugins/pepper_image_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return NULL; 72 return NULL;
73 return image_data->Map(); 73 return image_data->Map();
74 } 74 }
75 75
76 void Unmap(PP_Resource resource) { 76 void Unmap(PP_Resource resource) {
77 scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource)); 77 scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource));
78 if (image_data) 78 if (image_data)
79 image_data->Unmap(); 79 image_data->Unmap();
80 } 80 }
81 81
82 uint64_t GetNativeMemoryHandle2(PP_Resource resource) { 82 uint64_t GetNativeMemoryHandle2(PP_Resource resource, uint32_t* byte_count) {
83 scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource)); 83 scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource));
84 if (image_data) 84 if (image_data)
85 return image_data->GetNativeMemoryHandle(); 85 return image_data->GetNativeMemoryHandle(byte_count);
86 return 0; 86 return 0;
87 } 87 }
88 88
89 const PPB_ImageData ppb_imagedata = { 89 const PPB_ImageData ppb_imagedata = {
90 &GetNativeImageDataFormat, 90 &GetNativeImageDataFormat,
91 &IsImageDataFormatSupported, 91 &IsImageDataFormatSupported,
92 &Create, 92 &Create,
93 &IsImageData, 93 &IsImageData,
94 &Describe, 94 &Describe,
95 &Map, 95 &Map,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return bitmap.getAddr32(0, 0); 182 return bitmap.getAddr32(0, 0);
183 } 183 }
184 184
185 void ImageData::Unmap() { 185 void ImageData::Unmap() {
186 // This is currently unimplemented, which is OK. The data will just always 186 // This is currently unimplemented, which is OK. The data will just always
187 // be around once it's mapped. Chrome's TransportDIB isn't currently 187 // be around once it's mapped. Chrome's TransportDIB isn't currently
188 // unmappable without freeing it, but this may be something we want to support 188 // unmappable without freeing it, but this may be something we want to support
189 // in the future to save some memory. 189 // in the future to save some memory.
190 } 190 }
191 191
192 uint64 ImageData::GetNativeMemoryHandle() const { 192 uint64 ImageData::GetNativeMemoryHandle(uint32* byte_count) const {
193 return platform_image_->GetSharedMemoryHandle(); 193 return platform_image_->GetSharedMemoryHandle(byte_count);
194 } 194 }
195 195
196 const SkBitmap* ImageData::GetMappedBitmap() const { 196 const SkBitmap* ImageData::GetMappedBitmap() const {
197 if (!mapped_canvas_.get()) 197 if (!mapped_canvas_.get())
198 return NULL; 198 return NULL;
199 return &mapped_canvas_->getTopPlatformDevice().accessBitmap(false); 199 return &mapped_canvas_->getTopPlatformDevice().accessBitmap(false);
200 } 200 }
201 201
202 void ImageData::Swap(ImageData* other) { 202 void ImageData::Swap(ImageData* other) {
203 swap(other->platform_image_, platform_image_); 203 swap(other->platform_image_, platform_image_);
204 swap(other->mapped_canvas_, mapped_canvas_); 204 swap(other->mapped_canvas_, mapped_canvas_);
205 std::swap(other->format_, format_); 205 std::swap(other->format_, format_);
206 std::swap(other->width_, width_); 206 std::swap(other->width_, width_);
207 std::swap(other->height_, height_); 207 std::swap(other->height_, height_);
208 } 208 }
209 209
210 } // namespace pepper 210 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_image_data.h ('k') | webkit/glue/plugins/pepper_plugin_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698