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