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

Side by Side Diff: content/renderer/pepper/pepper_platform_context_3d_impl.h

Issue 12673002: pepper: Use the RenderThread's shared context as the parent context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: null context3d in swiftshader Created 7 years, 9 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
OLDNEW
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 "webkit/plugins/ppapi/plugin_delegate.h" 13 #include "webkit/plugins/ppapi/plugin_delegate.h"
14 14
15 #ifdef ENABLE_GPU 15 #ifdef ENABLE_GPU
16 16
17 class CommandBufferProxy; 17 class CommandBufferProxy;
18 namespace gpu { 18 namespace gpu {
19 class CommandBuffer; 19 class CommandBuffer;
20 } // namespace gpu 20 } // namespace gpu
21 21
22 namespace content { 22 namespace content {
23 class ContextProviderCommandBuffer;
23 class GpuChannelHost; 24 class GpuChannelHost;
24 25
25 class PepperParentContextProvider;
26
27 class PlatformContext3DImpl 26 class PlatformContext3DImpl
28 : public webkit::ppapi::PluginDelegate::PlatformContext3D { 27 : public webkit::ppapi::PluginDelegate::PlatformContext3D {
29 public: 28 public:
30 explicit PlatformContext3DImpl( 29 explicit PlatformContext3DImpl();
31 PepperParentContextProvider* parent_context_provider);
32 virtual ~PlatformContext3DImpl(); 30 virtual ~PlatformContext3DImpl();
33 31
34 virtual bool Init(const int32* attrib_list, 32 virtual bool Init(const int32* attrib_list,
35 PlatformContext3D* share_context) OVERRIDE; 33 PlatformContext3D* share_context) OVERRIDE;
36 virtual unsigned GetBackingTextureId() OVERRIDE; 34 virtual unsigned GetBackingTextureId() OVERRIDE;
37 virtual WebKit::WebGraphicsContext3D* GetParentContext() OVERRIDE; 35 virtual WebKit::WebGraphicsContext3D* GetParentContext() OVERRIDE;
38 virtual bool IsOpaque() OVERRIDE; 36 virtual bool IsOpaque() OVERRIDE;
39 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; 37 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
40 virtual int GetCommandBufferRouteId() OVERRIDE; 38 virtual int GetCommandBufferRouteId() OVERRIDE;
41 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; 39 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE;
42 virtual void SetOnConsoleMessageCallback( 40 virtual void SetOnConsoleMessageCallback(
43 const ConsoleMessageCallback& callback) OVERRIDE; 41 const ConsoleMessageCallback& callback) OVERRIDE;
44 virtual bool Echo(const base::Closure& task) OVERRIDE; 42 virtual bool Echo(const base::Closure& task) OVERRIDE;
45 43
46 virtual void SetParentContext( 44 bool SetParentAndCreateBackingTextureIfNeeded();
47 PepperParentContextProvider* parent_context_provider); 45 void DestroyParentContextProviderAndBackingTexture();
48 46
49 private: 47 private:
50 bool InitRaw(); 48 bool InitRaw();
51 void OnContextLost(); 49 void OnContextLost();
52 void OnConsoleMessage(const std::string& msg, int id); 50 void OnConsoleMessage(const std::string& msg, int id);
53 51
54 // Implicitly weak pointer; must outlive this instance. 52 scoped_refptr<ContextProviderCommandBuffer> parent_context_provider_;
55 PepperParentContextProvider* parent_context_provider_;
56 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> parent_context_;
57 scoped_refptr<GpuChannelHost> channel_; 53 scoped_refptr<GpuChannelHost> channel_;
58 unsigned int parent_texture_id_; 54 unsigned int parent_texture_id_;
59 bool has_alpha_; 55 bool has_alpha_;
60 CommandBufferProxyImpl* command_buffer_; 56 CommandBufferProxyImpl* command_buffer_;
61 base::Closure context_lost_callback_; 57 base::Closure context_lost_callback_;
62 ConsoleMessageCallback console_message_callback_; 58 ConsoleMessageCallback console_message_callback_;
63 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_; 59 base::WeakPtrFactory<PlatformContext3DImpl> weak_ptr_factory_;
64 }; 60 };
65 61
66 } // namespace content 62 } // namespace content
67 63
68 #endif // ENABLE_GPU 64 #endif // ENABLE_GPU
69 65
70 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ 66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_parent_context_provider.cc ('k') | content/renderer/pepper/pepper_platform_context_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698