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_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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ppapi/shared_impl/resource.h" |
9 #include "ppapi/thunk/ppb_surface_3d_api.h" | 10 #include "ppapi/thunk/ppb_surface_3d_api.h" |
10 #include "webkit/plugins/ppapi/callbacks.h" | 11 #include "webkit/plugins/ppapi/callbacks.h" |
11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 12 #include "webkit/plugins/ppapi/plugin_delegate.h" |
12 #include "webkit/plugins/ppapi/resource.h" | |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Size; | 15 class Size; |
16 } | 16 } |
17 | 17 |
18 namespace webkit { | 18 namespace webkit { |
19 namespace ppapi { | 19 namespace ppapi { |
20 | 20 |
21 class PPB_Context3D_Impl; | 21 class PPB_Context3D_Impl; |
22 | 22 |
23 class PPB_Surface3D_Impl : public Resource, | 23 class PPB_Surface3D_Impl : public ::ppapi::Resource, |
24 public ::ppapi::thunk::PPB_Surface3D_API { | 24 public ::ppapi::thunk::PPB_Surface3D_API { |
25 public: | 25 public: |
26 virtual ~PPB_Surface3D_Impl(); | 26 virtual ~PPB_Surface3D_Impl(); |
27 | 27 |
28 static PP_Resource Create(PluginInstance* instance_id, | 28 static PP_Resource Create(PP_Instance instance, |
29 PP_Config3D_Dev config, | 29 PP_Config3D_Dev config, |
30 const int32_t* attrib_list); | 30 const int32_t* attrib_list); |
31 | 31 |
32 // Resource override. | 32 // Resource override. |
33 virtual ::ppapi::thunk::PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE; | 33 virtual ::ppapi::thunk::PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE; |
34 | 34 |
35 // PPB_Surface3D_API implementation. | 35 // PPB_Surface3D_API implementation. |
36 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE; | 36 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE; |
37 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE; | 37 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE; |
38 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; | 38 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
51 // Returns true if successful. | 51 // Returns true if successful. |
52 bool BindToContext(PPB_Context3D_Impl* context); | 52 bool BindToContext(PPB_Context3D_Impl* context); |
53 | 53 |
54 unsigned int GetBackingTextureId(); | 54 unsigned int GetBackingTextureId(); |
55 | 55 |
56 void ViewInitiatedPaint(); | 56 void ViewInitiatedPaint(); |
57 void ViewFlushedPaint(); | 57 void ViewFlushedPaint(); |
58 void OnContextLost(); | 58 void OnContextLost(); |
59 | 59 |
60 private: | 60 private: |
61 explicit PPB_Surface3D_Impl(PluginInstance* instance); | 61 explicit PPB_Surface3D_Impl(PP_Instance instance); |
62 | 62 |
63 bool Init(PP_Config3D_Dev config, const int32_t* attrib_list); | 63 bool Init(PP_Config3D_Dev config, const int32_t* attrib_list); |
64 | 64 |
65 // Called when SwapBuffers is complete. | 65 // Called when SwapBuffers is complete. |
66 void OnSwapBuffers(); | 66 void OnSwapBuffers(); |
67 void SendContextLost(); | 67 void SendContextLost(); |
68 | 68 |
69 bool bound_to_instance_; | 69 bool bound_to_instance_; |
70 | 70 |
71 // True when the page's SwapBuffers has been issued but not returned yet. | 71 // True when the page's SwapBuffers has been issued but not returned yet. |
72 bool swap_initiated_; | 72 bool swap_initiated_; |
73 scoped_refptr<TrackedCompletionCallback> swap_callback_; | 73 scoped_refptr<TrackedCompletionCallback> swap_callback_; |
74 | 74 |
75 // The context this surface is currently bound to. | 75 // The context this surface is currently bound to. |
76 PPB_Context3D_Impl* context_; | 76 PPB_Context3D_Impl* context_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); | 78 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace ppapi | 81 } // namespace ppapi |
82 } // namespace webkit | 82 } // namespace webkit |
83 | 83 |
84 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ | 84 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
OLD | NEW |