| 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/single_thread_task_runner.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 16 #include "cc/output/context_provider.h" | 17 #include "cc/output/context_provider.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/common/gpu/client/command_buffer_metrics.h" | 19 #include "content/common/gpu/client/command_buffer_metrics.h" |
| 19 #include "gpu/command_buffer/client/shared_memory_limits.h" | 20 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 21 #include "gpu/ipc/common/gpu_stream_constants.h" | 22 #include "gpu/ipc/common/gpu_stream_constants.h" |
| 22 #include "gpu/ipc/common/surface_handle.h" | 23 #include "gpu/ipc/common/surface_handle.h" |
| 23 #include "ui/gl/gpu_preference.h" | 24 #include "ui/gl/gpu_preference.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 gpu::Capabilities ContextCapabilities() override; | 73 gpu::Capabilities ContextCapabilities() override; |
| 73 void DeleteCachedResources() override; | 74 void DeleteCachedResources() override; |
| 74 void SetLostContextCallback( | 75 void SetLostContextCallback( |
| 75 const LostContextCallback& lost_context_callback) override; | 76 const LostContextCallback& lost_context_callback) override; |
| 76 | 77 |
| 77 // Sets up a lock so this context can be used from multiple threads. After | 78 // Sets up a lock so this context can be used from multiple threads. After |
| 78 // calling this, all functions without explicit thread usage constraints can | 79 // calling this, all functions without explicit thread usage constraints can |
| 79 // be used on any thread while the lock returned by GetLock() is acquired. | 80 // be used on any thread while the lock returned by GetLock() is acquired. |
| 80 void SetupLock(); | 81 void SetupLock(); |
| 81 | 82 |
| 83 // Set the default task runner for command buffers to use for handling IPCs. |
| 84 // If not specified, this will be the ThreadTaskRunner for the thread on |
| 85 // which BindToThread is called. |
| 86 void SetDefaultTaskRunner( |
| 87 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner); |
| 88 |
| 82 protected: | 89 protected: |
| 83 ~ContextProviderCommandBuffer() override; | 90 ~ContextProviderCommandBuffer() override; |
| 84 | 91 |
| 85 void OnLostContext(); | 92 void OnLostContext(); |
| 86 | 93 |
| 87 private: | 94 private: |
| 88 struct SharedProviders : public base::RefCountedThreadSafe<SharedProviders> { | 95 struct SharedProviders : public base::RefCountedThreadSafe<SharedProviders> { |
| 89 base::Lock lock; | 96 base::Lock lock; |
| 90 std::vector<ContextProviderCommandBuffer*> list; | 97 std::vector<ContextProviderCommandBuffer*> list; |
| 91 | 98 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 gpu::SurfaceHandle surface_handle_; | 114 gpu::SurfaceHandle surface_handle_; |
| 108 GURL active_url_; | 115 GURL active_url_; |
| 109 gfx::GpuPreference gpu_preference_; | 116 gfx::GpuPreference gpu_preference_; |
| 110 bool automatic_flushes_; | 117 bool automatic_flushes_; |
| 111 gpu::SharedMemoryLimits memory_limits_; | 118 gpu::SharedMemoryLimits memory_limits_; |
| 112 gpu::gles2::ContextCreationAttribHelper attributes_; | 119 gpu::gles2::ContextCreationAttribHelper attributes_; |
| 113 command_buffer_metrics::ContextType context_type_; | 120 command_buffer_metrics::ContextType context_type_; |
| 114 | 121 |
| 115 scoped_refptr<SharedProviders> shared_providers_; | 122 scoped_refptr<SharedProviders> shared_providers_; |
| 116 scoped_refptr<gpu::GpuChannelHost> channel_; | 123 scoped_refptr<gpu::GpuChannelHost> channel_; |
| 124 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; |
| 117 | 125 |
| 118 base::Lock context_lock_; // Referenced by command_buffer_. | 126 base::Lock context_lock_; // Referenced by command_buffer_. |
| 119 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 127 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
| 120 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 128 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 121 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 129 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
| 122 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 130 std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
| 123 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; | 131 std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_; |
| 124 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; | 132 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; |
| 125 | 133 |
| 126 LostContextCallback lost_context_callback_; | 134 LostContextCallback lost_context_callback_; |
| 127 }; | 135 }; |
| 128 | 136 |
| 129 } // namespace content | 137 } // namespace content |
| 130 | 138 |
| 131 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 139 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
| OLD | NEW |