OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "cc/output/context_provider.h" | 16 #include "cc/output/context_provider.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/gpu/client/command_buffer_metrics.h" | 18 #include "content/common/gpu/client/command_buffer_metrics.h" |
19 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | |
20 #include "gpu/command_buffer/client/shared_memory_limits.h" | 19 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 21 #include "gpu/ipc/common/surface_handle.h" |
| 22 #include "ui/gl/gpu_preference.h" |
| 23 #include "url/gurl.h" |
21 | 24 |
22 namespace gpu { | 25 namespace gpu { |
23 class CommandBufferProxyImpl; | 26 class CommandBufferProxyImpl; |
| 27 class GpuChannelHost; |
24 namespace gles2 { | 28 namespace gles2 { |
25 class GLES2TraceImplementation; | 29 class GLES2TraceImplementation; |
26 } | 30 } |
27 } | 31 } |
28 | 32 |
29 namespace skia_bindings { | 33 namespace skia_bindings { |
30 class GrContextForGLES2Interface; | 34 class GrContextForGLES2Interface; |
31 } | 35 } |
32 | 36 |
33 namespace content { | 37 namespace content { |
| 38 class WebGraphicsContext3DCommandBufferImpl; |
34 | 39 |
35 // Implementation of cc::ContextProvider that provides a | 40 // Implementation of cc::ContextProvider that provides a GL implementation over |
36 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. | 41 // command buffer to the GPU process. |
37 class CONTENT_EXPORT ContextProviderCommandBuffer | 42 class CONTENT_EXPORT ContextProviderCommandBuffer |
38 : NON_EXPORTED_BASE(public cc::ContextProvider) { | 43 : NON_EXPORTED_BASE(public cc::ContextProvider) { |
39 public: | 44 public: |
40 ContextProviderCommandBuffer( | 45 ContextProviderCommandBuffer( |
41 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 46 scoped_refptr<gpu::GpuChannelHost> channel, |
| 47 gpu::SurfaceHandle surface_handle, |
| 48 const GURL& active_url, |
| 49 gfx::GpuPreference gpu_preference, |
| 50 bool automatic_flushes, |
42 const gpu::SharedMemoryLimits& memory_limits, | 51 const gpu::SharedMemoryLimits& memory_limits, |
43 const gpu::gles2::ContextCreationAttribHelper& attributes, | 52 const gpu::gles2::ContextCreationAttribHelper& attributes, |
44 ContextProviderCommandBuffer* shared_context_provider, | 53 ContextProviderCommandBuffer* shared_context_provider, |
45 command_buffer_metrics::ContextType type); | 54 command_buffer_metrics::ContextType type); |
46 | 55 |
47 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 56 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
48 | 57 |
49 // cc::ContextProvider implementation. | 58 // cc::ContextProvider implementation. |
50 bool BindToCurrentThread() override; | 59 bool BindToCurrentThread() override; |
51 void DetachFromThread() override; | 60 void DetachFromThread() override; |
(...skipping 22 matching lines...) Expand all Loading... |
74 | 83 |
75 private: | 84 private: |
76 friend class base::RefCountedThreadSafe<SharedProviders>; | 85 friend class base::RefCountedThreadSafe<SharedProviders>; |
77 ~SharedProviders(); | 86 ~SharedProviders(); |
78 }; | 87 }; |
79 | 88 |
80 base::ThreadChecker main_thread_checker_; | 89 base::ThreadChecker main_thread_checker_; |
81 base::ThreadChecker context_thread_checker_; | 90 base::ThreadChecker context_thread_checker_; |
82 | 91 |
83 bool bind_succeeded_ = false; | 92 bool bind_succeeded_ = false; |
| 93 |
| 94 gpu::SurfaceHandle surface_handle_; |
| 95 GURL active_url_; |
| 96 gfx::GpuPreference gpu_preference_; |
| 97 bool automatic_flushes_; |
| 98 gpu::SharedMemoryLimits memory_limits_; |
| 99 gpu::gles2::ContextCreationAttribHelper attributes_; |
| 100 command_buffer_metrics::ContextType context_type_; |
| 101 |
84 scoped_refptr<SharedProviders> shared_providers_; | 102 scoped_refptr<SharedProviders> shared_providers_; |
| 103 scoped_refptr<gpu::GpuChannelHost> channel_; |
85 | 104 |
86 base::Lock context_lock_; // Referenced by context3d_. | 105 base::Lock context_lock_; // Referenced by context3d_. |
87 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; | 106 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
88 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; | 107 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; |
89 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; | 108 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; |
90 | 109 |
91 gpu::SharedMemoryLimits memory_limits_; | |
92 gpu::gles2::ContextCreationAttribHelper attributes_; | |
93 command_buffer_metrics::ContextType context_type_; | |
94 | |
95 LostContextCallback lost_context_callback_; | 110 LostContextCallback lost_context_callback_; |
96 }; | 111 }; |
97 | 112 |
98 } // namespace content | 113 } // namespace content |
99 | 114 |
100 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 115 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
OLD | NEW |