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