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

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

Issue 7431001: Re-land r92885, which was reverted in r92891. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 | « ppapi/thunk/resource_creation_api.h ('k') | webkit/plugins/ppapi/ppb_graphics_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_GRAPHICS_3D_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
7 7
8 #include "ppapi/thunk/ppb_graphics_3d_api.h" 8 #include "base/memory/scoped_callback_factory.h"
9 #include "ppapi/shared_impl/graphics_3d_impl.h"
10 #include "webkit/plugins/ppapi/plugin_delegate.h"
9 #include "webkit/plugins/ppapi/resource.h" 11 #include "webkit/plugins/ppapi/resource.h"
10 12
11 namespace webkit { 13 namespace webkit {
12 namespace ppapi { 14 namespace ppapi {
13 15
14 class PPB_Graphics3D_Impl : public Resource, 16 class PPB_Graphics3D_Impl : public Resource,
15 public ::ppapi::thunk::PPB_Graphics3D_API { 17 public ::ppapi::Graphics3DImpl {
16 public: 18 public:
17 virtual ~PPB_Graphics3D_Impl(); 19 virtual ~PPB_Graphics3D_Impl();
18 20
19 static PP_Resource Create(PluginInstance* instance, 21 static PP_Resource Create(PluginInstance* instance,
20 PP_Config3D_Dev config, 22 PP_Config3D_Dev config,
21 PP_Resource share_context, 23 PP_Resource share_context,
22 const int32_t* attrib_list); 24 const int32_t* attrib_list);
25 static PP_Resource CreateRaw(PluginInstance* instance,
26 PP_Config3D_Dev config,
27 PP_Resource share_context,
28 const int32_t* attrib_list);
23 29
24 // ResourceObjectBase override. 30 // ResourceObjectBase override.
25 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE; 31 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE;
26 32
27 // PPB_Graphics3D_API implementation. 33 // PPB_Graphics3D_API trusted implementation.
28 virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE; 34 virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE;
29 virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE; 35 virtual PP_Bool GetRingBuffer(int* shm_handle,
30 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; 36 uint32_t* shm_size) OVERRIDE;
37 virtual PP_Graphics3DTrustedState GetState() OVERRIDE;
38 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
39 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
40 virtual PP_Bool GetTransferBuffer(int32_t id,
41 int* shm_handle,
42 uint32_t* shm_size) OVERRIDE;
43 virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
44 virtual PP_Graphics3DTrustedState FlushSync(int32_t put_offset) OVERRIDE;
45 virtual PP_Graphics3DTrustedState FlushSyncFast(
46 int32_t put_offset,
47 int32_t last_known_get) OVERRIDE;
48
49 // Binds/unbinds the graphics of this context with the associated instance.
50 // Returns true if binding/unbinding is successful.
51 bool BindToInstance(bool bind);
52
53 // Returns the id of texture that can be used by the compositor.
54 unsigned int GetBackingTextureId();
55
56 // Notifications that the view has rendered the page and that it has been
57 // flushed to the screen. These messages are used to send Flush callbacks to
58 // the plugin.
59 void ViewInitiatedPaint();
60 void ViewFlushedPaint();
61
62 protected:
63 // ppapi::Graphics3DImpl overrides.
64 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
65 virtual int32 DoSwapBuffers() OVERRIDE;
31 66
32 private: 67 private:
33 explicit PPB_Graphics3D_Impl(PluginInstance* instance); 68 explicit PPB_Graphics3D_Impl(PluginInstance* instance);
34 69
35 bool Init(PP_Config3D_Dev config, 70 bool Init(PP_Config3D_Dev config,
36 PP_Resource share_context, 71 PP_Resource share_context,
37 const int32_t* attrib_list); 72 const int32_t* attrib_list);
73 bool InitRaw(PP_Config3D_Dev config,
74 PP_Resource share_context,
75 const int32_t* attrib_list);
76
77 // Notifications received from the GPU process.
78 void OnSwapBuffers();
79 void OnContextLost();
80 // Notifications sent to plugin.
81 void SendContextLost();
82
83 // True if context is bound to instance.
84 bool bound_to_instance_;
85 // True when waiting for compositor to commit our backing texture.
86 bool commit_pending_;
87 // PluginDelegate's 3D Context. Responsible for providing the command buffer.
88 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
89 base::ScopedCallbackFactory<PPB_Graphics3D_Impl> callback_factory_;
38 90
39 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); 91 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
40 }; 92 };
41 93
42 } // namespace ppapi 94 } // namespace ppapi
43 } // namespace webkit 95 } // namespace webkit
44 96
45 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ 97 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
46
OLDNEW
« no previous file with comments | « ppapi/thunk/resource_creation_api.h ('k') | webkit/plugins/ppapi/ppb_graphics_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698