OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 12 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 13 #include "gpu/command_buffer/common/mailbox.h" |
13 #include "webkit/plugins/ppapi/plugin_delegate.h" | 14 #include "webkit/plugins/ppapi/plugin_delegate.h" |
14 | 15 |
15 #ifdef ENABLE_GPU | 16 #ifdef ENABLE_GPU |
16 | 17 |
17 class CommandBufferProxy; | 18 class CommandBufferProxy; |
18 namespace gpu { | 19 namespace gpu { |
19 class CommandBuffer; | 20 class CommandBuffer; |
20 } // namespace gpu | 21 } // namespace gpu |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 class ContextProviderCommandBuffer; | 24 class ContextProviderCommandBuffer; |
24 class GpuChannelHost; | 25 class GpuChannelHost; |
25 | 26 |
26 class PlatformContext3DImpl | 27 class PlatformContext3DImpl |
27 : public webkit::ppapi::PluginDelegate::PlatformContext3D { | 28 : public webkit::ppapi::PluginDelegate::PlatformContext3D { |
28 public: | 29 public: |
29 explicit PlatformContext3DImpl(); | 30 explicit PlatformContext3DImpl(); |
30 virtual ~PlatformContext3DImpl(); | 31 virtual ~PlatformContext3DImpl(); |
31 | 32 |
32 virtual bool Init(const int32* attrib_list, | 33 virtual bool Init(const int32* attrib_list, |
33 PlatformContext3D* share_context) OVERRIDE; | 34 PlatformContext3D* share_context) OVERRIDE; |
34 virtual unsigned GetBackingTextureId() OVERRIDE; | 35 virtual void GetBackingMailbox(gpu::Mailbox* mailbox) OVERRIDE; |
35 virtual WebKit::WebGraphicsContext3D* GetParentContext() OVERRIDE; | |
36 virtual bool IsOpaque() OVERRIDE; | 36 virtual bool IsOpaque() OVERRIDE; |
37 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; | 37 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; |
38 virtual int GetCommandBufferRouteId() OVERRIDE; | 38 virtual int GetCommandBufferRouteId() OVERRIDE; |
39 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; | 39 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; |
40 virtual void SetOnConsoleMessageCallback( | 40 virtual void SetOnConsoleMessageCallback( |
41 const ConsoleMessageCallback& callback) OVERRIDE; | 41 const ConsoleMessageCallback& callback) OVERRIDE; |
42 virtual bool Echo(const base::Closure& task) OVERRIDE; | 42 virtual bool Echo(const base::Closure& task) OVERRIDE; |
43 | 43 |
44 bool SetParentAndCreateBackingTextureIfNeeded(); | |
45 void DestroyParentContextProviderAndBackingTexture(); | |
46 | |
47 private: | 44 private: |
48 bool InitRaw(); | 45 bool InitRaw(); |
49 void OnContextLost(); | 46 void OnContextLost(); |
50 void OnConsoleMessage(const std::string& msg, int id); | 47 void OnConsoleMessage(const std::string& msg, int id); |
51 | 48 |
52 scoped_refptr<ContextProviderCommandBuffer> parent_context_provider_; | |
53 scoped_refptr<GpuChannelHost> channel_; | 49 scoped_refptr<GpuChannelHost> channel_; |
54 gpu::Mailbox mailbox_; | 50 gpu::Mailbox mailbox_; |
55 unsigned int parent_texture_id_; | |
56 bool has_alpha_; | 51 bool has_alpha_; |
57 CommandBufferProxyImpl* command_buffer_; | 52 CommandBufferProxyImpl* command_buffer_; |
58 base::Closure context_lost_callback_; | 53 base::Closure context_lost_callback_; |
59 ConsoleMessageCallback console_message_callback_; | 54 ConsoleMessageCallback console_message_callback_; |
60 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_; | 55 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_; |
61 }; | 56 }; |
62 | 57 |
63 } // namespace content | 58 } // namespace content |
64 | 59 |
65 #endif // ENABLE_GPU | 60 #endif // ENABLE_GPU |
66 | 61 |
67 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ | 62 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ |
OLD | NEW |