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 WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/ppb_graphics_2d.h" | 13 #include "ppapi/c/ppb_graphics_2d.h" |
14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
15 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 15 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
17 | 17 |
18 struct PPB_Graphics2D; | 18 struct PPB_Graphics2D; |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Rect; | 21 class Rect; |
22 } | 22 } |
23 | 23 |
24 namespace webkit { | 24 namespace webkit { |
25 namespace ppapi { | 25 namespace ppapi { |
26 | 26 |
27 class PPB_ImageData_Impl; | 27 class PPB_ImageData_Impl; |
28 class PluginInstance; | 28 class PluginInstance; |
29 class PluginModule; | |
30 | 29 |
31 class PPB_Graphics2D_Impl : public ::ppapi::Resource, | 30 class PPB_Graphics2D_Impl : public ::ppapi::Resource, |
32 public ::ppapi::thunk::PPB_Graphics2D_API { | 31 public ::ppapi::thunk::PPB_Graphics2D_API { |
33 public: | 32 public: |
34 virtual ~PPB_Graphics2D_Impl(); | 33 virtual ~PPB_Graphics2D_Impl(); |
35 | 34 |
36 static PP_Resource Create(PP_Instance instance, | 35 static PP_Resource Create(PP_Instance instance, |
37 const PP_Size& size, | 36 const PP_Size& size, |
38 PP_Bool is_always_opaque); | 37 PP_Bool is_always_opaque); |
39 | 38 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 78 |
80 bool Init(int width, int height, bool is_always_opaque); | 79 bool Init(int width, int height, bool is_always_opaque); |
81 | 80 |
82 // Tracks a call to flush that requires a callback. | 81 // Tracks a call to flush that requires a callback. |
83 class FlushCallbackData { | 82 class FlushCallbackData { |
84 public: | 83 public: |
85 FlushCallbackData() { | 84 FlushCallbackData() { |
86 Clear(); | 85 Clear(); |
87 } | 86 } |
88 | 87 |
89 FlushCallbackData(const PP_CompletionCallback& callback) { | 88 explicit FlushCallbackData(const PP_CompletionCallback& callback) { |
90 Set(callback); | 89 Set(callback); |
91 } | 90 } |
92 | 91 |
93 bool is_null() const { return !callback_.func; } | 92 bool is_null() const { return !callback_.func; } |
94 | 93 |
95 void Set(const PP_CompletionCallback& callback) { | 94 void Set(const PP_CompletionCallback& callback) { |
96 callback_ = callback; | 95 callback_ = callback; |
97 } | 96 } |
98 | 97 |
99 void Clear() { | 98 void Clear() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 176 |
178 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; | 177 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; |
179 | 178 |
180 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); | 179 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); |
181 }; | 180 }; |
182 | 181 |
183 } // namespace ppapi | 182 } // namespace ppapi |
184 } // namespace webkit | 183 } // namespace webkit |
185 | 184 |
186 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 185 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
OLD | NEW |