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

Side by Side Diff: webkit/plugins/ppapi/ppb_image_data_impl.h

Issue 6905088: New thunk system for Pepper proxy and implementation (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
OLDNEW
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 WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ppapi/c/ppb_image_data.h" 10 #include "ppapi/c/ppb_image_data.h"
11 #include "ppapi/shared_impl/image_data_impl.h" 11 #include "ppapi/shared_impl/image_data_impl.h"
12 #include "ppapi/thunk/ppb_image_data_api.h"
12 #include "webkit/plugins/ppapi/plugin_delegate.h" 13 #include "webkit/plugins/ppapi/plugin_delegate.h"
13 #include "webkit/plugins/ppapi/resource.h" 14 #include "webkit/plugins/ppapi/resource.h"
14 15
15 namespace skia { 16 namespace skia {
16 class PlatformCanvas; 17 class PlatformCanvas;
17 } 18 }
18 19
19 struct PPB_ImageDataTrusted; 20 struct PPB_ImageDataTrusted;
20 class SkBitmap; 21 class SkBitmap;
21 22
22 namespace webkit { 23 namespace webkit {
23 namespace ppapi { 24 namespace ppapi {
24 25
25 class PPB_ImageData_Impl : public Resource, 26 class PPB_ImageData_Impl : public Resource,
26 public pp::shared_impl::ImageDataImpl { 27 public pp::shared_impl::ImageDataImpl,
28 public ::ppapi::thunk::PPB_ImageData_API {
27 public: 29 public:
28 explicit PPB_ImageData_Impl(PluginInstance* instance); 30 explicit PPB_ImageData_Impl(PluginInstance* instance);
29 virtual ~PPB_ImageData_Impl(); 31 virtual ~PPB_ImageData_Impl();
30 32
33 bool Init(PP_ImageDataFormat format,
34 int width, int height,
35 bool init_to_zero);
36
31 int width() const { return width_; } 37 int width() const { return width_; }
32 int height() const { return height_; } 38 int height() const { return height_; }
33 39
34 // Returns the image format. 40 // Returns the image format.
35 PP_ImageDataFormat format() const { return format_; } 41 PP_ImageDataFormat format() const { return format_; }
36 42
37 // Returns true if this image is mapped. False means that the image is either 43 // Returns true if this image is mapped. False means that the image is either
38 // invalid or not mapped. See ImageDataAutoMapper below. 44 // invalid or not mapped. See ImageDataAutoMapper below.
39 bool is_mapped() const { return !!mapped_canvas_.get(); } 45 bool is_mapped() const { return !!mapped_canvas_.get(); }
40 46
41 PluginDelegate::PlatformImage2D* platform_image() const { 47 PluginDelegate::PlatformImage2D* platform_image() const {
42 return platform_image_.get(); 48 return platform_image_.get();
43 } 49 }
44 50
45 // Returns a pointer to the interface implementing PPB_ImageData that is 51 // Returns a pointer to the interface implementing PPB_ImageData that is
46 // exposed to the plugin. 52 // exposed to the plugin.
47 static const PPB_ImageData* GetInterface(); 53 static const PPB_ImageData* GetInterface();
48 static const PPB_ImageDataTrusted* GetTrustedInterface(); 54 static const PPB_ImageDataTrusted* GetTrustedInterface();
49 55
56 virtual ::ppapi::thunk::PPB_ImageData_API* AsImageData_API();
57
50 // Resource overrides. 58 // Resource overrides.
51 virtual PPB_ImageData_Impl* AsPPB_ImageData_Impl(); 59 virtual PPB_ImageData_Impl* AsPPB_ImageData_Impl();
52 60
53 // PPB_ImageData implementation. 61 // PPB_ImageData_API implementation.
54 bool Init(PP_ImageDataFormat format, 62 virtual PP_Bool Describe(PP_ImageDataDesc* desc);
55 int width, int height, 63 virtual void* Map();
56 bool init_to_zero); 64 virtual void Unmap();
57 void Describe(PP_ImageDataDesc* desc) const;
58 void* Map();
59 void Unmap();
60 65
61 // PPB_ImageDataTrusted implementation. 66 // PPB_ImageDataTrusted implementation.
62 int GetSharedMemoryHandle(uint32* byte_count) const; 67 int GetSharedMemoryHandle(uint32* byte_count) const;
63 68
64 // The mapped bitmap and canvas will be NULL if the image is not mapped. 69 // The mapped bitmap and canvas will be NULL if the image is not mapped.
65 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } 70 skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); }
66 const SkBitmap* GetMappedBitmap() const; 71 const SkBitmap* GetMappedBitmap() const;
67 72
68 // Swaps the guts of this image data with another. 73 // Swaps the guts of this image data with another.
69 void Swap(PPB_ImageData_Impl* other); 74 void Swap(PPB_ImageData_Impl* other);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 bool is_valid_; 124 bool is_valid_;
120 bool needs_unmap_; 125 bool needs_unmap_;
121 126
122 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); 127 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper);
123 }; 128 };
124 129
125 } // namespace ppapi 130 } // namespace ppapi
126 } // namespace webkit 131 } // namespace webkit
127 132
128 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_ 133 #endif // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698