| 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_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "webkit/plugins/ppapi/plugin_delegate.h" | 10 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 11 | 11 |
| 12 #ifdef ENABLE_GPU | 12 #ifdef ENABLE_GPU |
| 13 | 13 |
| 14 namespace gpu { | 14 namespace gpu { |
| 15 | 15 |
| 16 class CommandBuffer; | 16 class CommandBuffer; |
| 17 | 17 |
| 18 } // namespace gpu | 18 } // namespace gpu |
| 19 | 19 |
| 20 class CommandBufferProxy; | 20 class CommandBufferProxy; |
| 21 class GpuChannelHost; | 21 class GpuChannelHost; |
| 22 class PepperParentContextProvider; | 22 class PepperParentContextProvider; |
| 23 class RendererGLContext; | 23 class ContentGLContext; |
| 24 | 24 |
| 25 class PlatformContext3DImpl | 25 class PlatformContext3DImpl |
| 26 : public webkit::ppapi::PluginDelegate::PlatformContext3D { | 26 : public webkit::ppapi::PluginDelegate::PlatformContext3D { |
| 27 public: | 27 public: |
| 28 explicit PlatformContext3DImpl( | 28 explicit PlatformContext3DImpl( |
| 29 PepperParentContextProvider* parent_context_provider); | 29 PepperParentContextProvider* parent_context_provider); |
| 30 virtual ~PlatformContext3DImpl(); | 30 virtual ~PlatformContext3DImpl(); |
| 31 | 31 |
| 32 virtual bool Init(const int32* attrib_list) OVERRIDE; | 32 virtual bool Init(const int32* attrib_list) OVERRIDE; |
| 33 virtual unsigned GetBackingTextureId() OVERRIDE; | 33 virtual unsigned GetBackingTextureId() OVERRIDE; |
| 34 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; | 34 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; |
| 35 virtual int GetCommandBufferRouteId() OVERRIDE; | 35 virtual int GetCommandBufferRouteId() OVERRIDE; |
| 36 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; | 36 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; |
| 37 virtual bool Echo(const base::Closure& task) OVERRIDE; | 37 virtual bool Echo(const base::Closure& task) OVERRIDE; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 bool InitRaw(); | 40 bool InitRaw(); |
| 41 void OnContextLost(); | 41 void OnContextLost(); |
| 42 | 42 |
| 43 // Implicitly weak pointer; must outlive this instance. | 43 // Implicitly weak pointer; must outlive this instance. |
| 44 PepperParentContextProvider* parent_context_provider_; | 44 PepperParentContextProvider* parent_context_provider_; |
| 45 base::WeakPtr<RendererGLContext> parent_context_; | 45 base::WeakPtr<ContentGLContext> parent_context_; |
| 46 scoped_refptr<GpuChannelHost> channel_; | 46 scoped_refptr<GpuChannelHost> channel_; |
| 47 unsigned int parent_texture_id_; | 47 unsigned int parent_texture_id_; |
| 48 CommandBufferProxy* command_buffer_; | 48 CommandBufferProxy* command_buffer_; |
| 49 base::Closure context_lost_callback_; | 49 base::Closure context_lost_callback_; |
| 50 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_; | 50 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 #endif // ENABLE_GPU | 53 #endif // ENABLE_GPU |
| 54 | 54 |
| 55 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 55 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
| OLD | NEW |