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 #ifndef CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 4 #ifndef CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
5 #define CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 5 #define CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 11 #include "webkit/plugins/ppapi/plugin_delegate.h" |
12 | 12 |
13 #ifdef ENABLE_GPU | 13 #ifdef ENABLE_GPU |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 class CommandBuffer; | 17 class CommandBuffer; |
18 | 18 |
19 } // namespace gpu | 19 } // namespace gpu |
20 | 20 |
21 class CommandBufferProxy; | 21 class CommandBufferProxy; |
22 class GpuChannelHost; | 22 class GpuChannelHost; |
23 class RendererGLContext; | 23 class RendererGLContext; |
| 24 class Task; |
24 | 25 |
25 class PlatformContext3DImpl | 26 class PlatformContext3DImpl |
26 : public webkit::ppapi::PluginDelegate::PlatformContext3D { | 27 : public webkit::ppapi::PluginDelegate::PlatformContext3D { |
27 public: | 28 public: |
28 explicit PlatformContext3DImpl(RendererGLContext* parent_context); | 29 explicit PlatformContext3DImpl(RendererGLContext* parent_context); |
29 virtual ~PlatformContext3DImpl(); | 30 virtual ~PlatformContext3DImpl(); |
30 | 31 |
31 virtual bool Init(const int32* attrib_list); | 32 virtual bool Init(const int32* attrib_list); |
32 virtual void SetSwapBuffersCallback(Callback0::Type* callback); | |
33 virtual unsigned GetBackingTextureId(); | 33 virtual unsigned GetBackingTextureId(); |
34 virtual gpu::CommandBuffer* GetCommandBuffer(); | 34 virtual gpu::CommandBuffer* GetCommandBuffer(); |
35 virtual int GetCommandBufferRouteId(); | 35 virtual int GetCommandBufferRouteId(); |
36 virtual void SetContextLostCallback(Callback0::Type* callback); | 36 virtual void SetContextLostCallback(Callback0::Type* callback); |
| 37 virtual bool Echo(Task* task); |
37 | 38 |
38 private: | 39 private: |
39 bool InitRaw(); | 40 bool InitRaw(); |
40 void OnContextLost(); | 41 void OnContextLost(); |
41 | 42 |
42 base::WeakPtr<RendererGLContext> parent_context_; | 43 base::WeakPtr<RendererGLContext> parent_context_; |
43 scoped_refptr<GpuChannelHost> channel_; | 44 scoped_refptr<GpuChannelHost> channel_; |
44 unsigned int parent_texture_id_; | 45 unsigned int parent_texture_id_; |
45 CommandBufferProxy* command_buffer_; | 46 CommandBufferProxy* command_buffer_; |
46 scoped_ptr<Callback0::Type> context_lost_callback_; | 47 scoped_ptr<Callback0::Type> context_lost_callback_; |
47 base::ScopedCallbackFactory<PlatformContext3DImpl> callback_factory_; | 48 base::ScopedCallbackFactory<PlatformContext3DImpl> callback_factory_; |
48 }; | 49 }; |
49 | 50 |
50 #endif // ENABLE_GPU | 51 #endif // ENABLE_GPU |
51 | 52 |
52 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 53 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
OLD | NEW |