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

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

Issue 7206016: Convert most remaining resources to use the API/thunk system. The significant (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « webkit/plugins/ppapi/ppb_scrollbar_impl.cc ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.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) 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "ppapi/c/dev/ppb_surface_3d_dev.h" 9 #include "ppapi/thunk/ppb_surface_3d_api.h"
10 #include "webkit/plugins/ppapi/plugin_delegate.h" 10 #include "webkit/plugins/ppapi/plugin_delegate.h"
11 #include "webkit/plugins/ppapi/resource.h" 11 #include "webkit/plugins/ppapi/resource.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Size; 14 class Size;
15 } 15 }
16 16
17 namespace webkit { 17 namespace webkit {
18 namespace ppapi { 18 namespace ppapi {
19 19
20 class PPB_Surface3D_Impl : public Resource { 20 class PPB_Context3D_Impl;
21
22 class PPB_Surface3D_Impl : public Resource,
23 public ::ppapi::thunk::PPB_Surface3D_API {
21 public: 24 public:
22 explicit PPB_Surface3D_Impl(PluginInstance* instance);
23 virtual ~PPB_Surface3D_Impl(); 25 virtual ~PPB_Surface3D_Impl();
24 26
25 static const PPB_Surface3D_Dev* GetInterface(); 27 static PP_Resource Create(PP_Instance instance_id,
28 PP_Config3D_Dev config,
29 const int32_t* attrib_list);
26 30
27 // Resource override. 31 // ResourceObjectBase override.
28 virtual PPB_Surface3D_Impl* AsPPB_Surface3D_Impl(); 32 virtual ::ppapi::thunk::PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE;
29 33
30 bool Init(PP_Config3D_Dev config, 34 // PPB_Surface3D_API implementation.
31 const int32_t* attrib_list); 35 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE;
36 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
37 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
32 38
33 PPB_Context3D_Impl* context() const { 39 PPB_Context3D_Impl* context() const {
34 return context_; 40 return context_;
35 } 41 }
36 42
37 // Binds/unbinds the graphics of this surface with the associated instance. 43 // Binds/unbinds the graphics of this surface with the associated instance.
38 // If the surface is bound, anything drawn on the surface appears on instance 44 // If the surface is bound, anything drawn on the surface appears on instance
39 // window. Returns true if binding/unbinding is successful. 45 // window. Returns true if binding/unbinding is successful.
40 bool BindToInstance(bool bind); 46 bool BindToInstance(bool bind);
41 47
42 // Binds the context such that all draw calls to context 48 // Binds the context such that all draw calls to context
43 // affect this surface. To unbind call this function will NULL context. 49 // affect this surface. To unbind call this function will NULL context.
44 // Returns true if successful. 50 // Returns true if successful.
45 bool BindToContext(PPB_Context3D_Impl* context); 51 bool BindToContext(PPB_Context3D_Impl* context);
46 52
47 unsigned int GetBackingTextureId(); 53 unsigned int GetBackingTextureId();
48 54
49 int32_t SwapBuffers(PP_CompletionCallback callback);
50
51 void ViewInitiatedPaint(); 55 void ViewInitiatedPaint();
52 void ViewFlushedPaint(); 56 void ViewFlushedPaint();
53 void OnContextLost(); 57 void OnContextLost();
54 58
55 private: 59 private:
60 explicit PPB_Surface3D_Impl(PluginInstance* instance);
61
62 bool Init(PP_Config3D_Dev config, const int32_t* attrib_list);
63
56 // Called when SwapBuffers is complete. 64 // Called when SwapBuffers is complete.
57 void OnSwapBuffers(); 65 void OnSwapBuffers();
58 void SendContextLost(); 66 void SendContextLost();
59 67
60 bool bound_to_instance_; 68 bool bound_to_instance_;
61 69
62 // True when the page's SwapBuffers has been issued but not returned yet. 70 // True when the page's SwapBuffers has been issued but not returned yet.
63 bool swap_initiated_; 71 bool swap_initiated_;
64 PP_CompletionCallback swap_callback_; 72 PP_CompletionCallback swap_callback_;
65 73
66 // The context this surface is currently bound to. 74 // The context this surface is currently bound to.
67 PPB_Context3D_Impl* context_; 75 PPB_Context3D_Impl* context_;
68 76
69 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); 77 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl);
70 }; 78 };
71 79
72 } // namespace ppapi 80 } // namespace ppapi
73 } // namespace webkit 81 } // namespace webkit
74 82
75 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ 83 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_scrollbar_impl.cc ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698