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 SERVICES_UI_PUBLIC_CPP_GPU_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
6 #define SERVICES_UI_PUBLIC_CPP_GPU_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_GPU_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/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "base/trace_event/memory_dump_provider.h" | 17 #include "base/trace_event/memory_dump_provider.h" |
18 #include "cc/output/context_provider.h" | 18 #include "cc/output/context_provider.h" |
19 #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" | 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
21 #include "gpu/ipc/common/gpu_stream_constants.h" | 21 #include "gpu/command_buffer/common/scheduling_priority.h" |
22 #include "gpu/ipc/common/surface_handle.h" | 22 #include "gpu/ipc/common/surface_handle.h" |
23 #include "services/ui/public/cpp/gpu/command_buffer_metrics.h" | 23 #include "services/ui/public/cpp/gpu/command_buffer_metrics.h" |
24 #include "ui/gl/gpu_preference.h" | 24 #include "ui/gl/gpu_preference.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 namespace gpu { | 27 namespace gpu { |
28 class CommandBufferProxyImpl; | 28 class CommandBufferProxyImpl; |
29 class GpuChannelHost; | 29 class GpuChannelHost; |
30 class TransferBuffer; | 30 class TransferBuffer; |
31 namespace gles2 { | 31 namespace gles2 { |
(...skipping 11 matching lines...) Expand all Loading... |
43 | 43 |
44 // Implementation of cc::ContextProvider that provides a GL implementation over | 44 // Implementation of cc::ContextProvider that provides a GL implementation over |
45 // command buffer to the GPU process. | 45 // command buffer to the GPU process. |
46 class ContextProviderCommandBuffer | 46 class ContextProviderCommandBuffer |
47 : public cc::ContextProvider, | 47 : public cc::ContextProvider, |
48 public base::trace_event::MemoryDumpProvider { | 48 public base::trace_event::MemoryDumpProvider { |
49 public: | 49 public: |
50 ContextProviderCommandBuffer( | 50 ContextProviderCommandBuffer( |
51 scoped_refptr<gpu::GpuChannelHost> channel, | 51 scoped_refptr<gpu::GpuChannelHost> channel, |
52 int32_t stream_id, | 52 int32_t stream_id, |
53 gpu::GpuStreamPriority stream_priority, | 53 gpu::SchedulingPriority stream_priority, |
54 gpu::SurfaceHandle surface_handle, | 54 gpu::SurfaceHandle surface_handle, |
55 const GURL& active_url, | 55 const GURL& active_url, |
56 bool automatic_flushes, | 56 bool automatic_flushes, |
57 bool support_locking, | 57 bool support_locking, |
58 const gpu::SharedMemoryLimits& memory_limits, | 58 const gpu::SharedMemoryLimits& memory_limits, |
59 const gpu::gles2::ContextCreationAttribHelper& attributes, | 59 const gpu::gles2::ContextCreationAttribHelper& attributes, |
60 ContextProviderCommandBuffer* shared_context_provider, | 60 ContextProviderCommandBuffer* shared_context_provider, |
61 command_buffer_metrics::ContextType type); | 61 command_buffer_metrics::ContextType type); |
62 | 62 |
63 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 63 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ~SharedProviders(); | 105 ~SharedProviders(); |
106 }; | 106 }; |
107 | 107 |
108 base::ThreadChecker main_thread_checker_; | 108 base::ThreadChecker main_thread_checker_; |
109 base::ThreadChecker context_thread_checker_; | 109 base::ThreadChecker context_thread_checker_; |
110 | 110 |
111 bool bind_succeeded_ = false; | 111 bool bind_succeeded_ = false; |
112 bool bind_failed_ = false; | 112 bool bind_failed_ = false; |
113 | 113 |
114 const int32_t stream_id_; | 114 const int32_t stream_id_; |
115 const gpu::GpuStreamPriority stream_priority_; | 115 const gpu::SchedulingPriority stream_priority_; |
116 const gpu::SurfaceHandle surface_handle_; | 116 const gpu::SurfaceHandle surface_handle_; |
117 const GURL active_url_; | 117 const GURL active_url_; |
118 const bool automatic_flushes_; | 118 const bool automatic_flushes_; |
119 const bool support_locking_; | 119 const bool support_locking_; |
120 const gpu::SharedMemoryLimits memory_limits_; | 120 const gpu::SharedMemoryLimits memory_limits_; |
121 const gpu::gles2::ContextCreationAttribHelper attributes_; | 121 const gpu::gles2::ContextCreationAttribHelper attributes_; |
122 const command_buffer_metrics::ContextType context_type_; | 122 const command_buffer_metrics::ContextType context_type_; |
123 | 123 |
124 scoped_refptr<SharedProviders> shared_providers_; | 124 scoped_refptr<SharedProviders> shared_providers_; |
125 scoped_refptr<gpu::GpuChannelHost> channel_; | 125 scoped_refptr<gpu::GpuChannelHost> channel_; |
126 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; |
127 | 127 |
128 base::Lock context_lock_; // Referenced by command_buffer_. | 128 base::Lock context_lock_; // Referenced by command_buffer_. |
129 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 129 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
130 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 130 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
131 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 131 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
132 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 132 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
133 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; | 133 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; |
134 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; | 134 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; |
135 std::unique_ptr<cc::ContextCacheController> cache_controller_; | 135 std::unique_ptr<cc::ContextCacheController> cache_controller_; |
136 | 136 |
137 LostContextCallback lost_context_callback_; | 137 LostContextCallback lost_context_callback_; |
138 }; | 138 }; |
139 | 139 |
140 } // namespace ui | 140 } // namespace ui |
141 | 141 |
142 #endif // SERVICES_UI_PUBLIC_CPP_GPU_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 142 #endif // SERVICES_UI_PUBLIC_CPP_GPU_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
OLD | NEW |