OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 gpu::GpuChannelHost* host, | 68 gpu::GpuChannelHost* host, |
69 gfx::GpuPreference gpu_preference, | 69 gfx::GpuPreference gpu_preference, |
70 bool automatic_flushes); | 70 bool automatic_flushes); |
71 | 71 |
72 CONTENT_EXPORT ~WebGraphicsContext3DCommandBufferImpl(); | 72 CONTENT_EXPORT ~WebGraphicsContext3DCommandBufferImpl(); |
73 | 73 |
74 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { | 74 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { |
75 return command_buffer_.get(); | 75 return command_buffer_.get(); |
76 } | 76 } |
77 | 77 |
78 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); | |
79 | |
80 gpu::gles2::GLES2Implementation* GetImplementation() { | 78 gpu::gles2::GLES2Implementation* GetImplementation() { |
81 return real_gl_.get(); | 79 return real_gl_.get(); |
82 } | 80 } |
83 | 81 |
84 void SetContextLostCallback(WebGraphicsContextLostCallback* callback) { | 82 void SetContextLostCallback(WebGraphicsContextLostCallback* callback) { |
85 context_lost_callback_ = callback; | 83 context_lost_callback_ = callback; |
86 } | 84 } |
87 | 85 |
88 CONTENT_EXPORT bool InitializeOnCurrentThread( | 86 CONTENT_EXPORT bool InitializeOnCurrentThread( |
89 const gpu::SharedMemoryLimits& memory_limits, | 87 const gpu::SharedMemoryLimits& memory_limits, |
90 gpu::CommandBufferProxyImpl* shared_command_buffer, | 88 gpu::CommandBufferProxyImpl* shared_command_buffer, |
91 scoped_refptr<gpu::gles2::ShareGroup> share_group, | 89 scoped_refptr<gpu::gles2::ShareGroup> share_group, |
92 const gpu::gles2::ContextCreationAttribHelper& attributes, | 90 const gpu::gles2::ContextCreationAttribHelper& attributes, |
93 command_buffer_metrics::ContextType context_type); | 91 command_buffer_metrics::ContextType context_type); |
94 | 92 |
95 private: | 93 private: |
96 // Initialize the underlying GL context. May be called multiple times; second | |
97 // and subsequent calls are ignored. Must be called from the thread that is | |
98 // going to use this object to issue GL commands (which might not be the main | |
99 // thread). | |
100 bool MaybeInitializeGL( | 94 bool MaybeInitializeGL( |
101 const gpu::SharedMemoryLimits& memory_limits, | 95 const gpu::SharedMemoryLimits& memory_limits, |
102 gpu::CommandBufferProxyImpl* shared_command_buffer, | 96 gpu::CommandBufferProxyImpl* shared_command_buffer, |
103 scoped_refptr<gpu::gles2::ShareGroup> share_group, | 97 scoped_refptr<gpu::gles2::ShareGroup> share_group, |
104 const gpu::gles2::ContextCreationAttribHelper& attributes, | 98 const gpu::gles2::ContextCreationAttribHelper& attributes, |
105 command_buffer_metrics::ContextType context_type); | 99 command_buffer_metrics::ContextType context_type); |
106 | 100 |
107 bool InitializeCommandBuffer( | |
108 gpu::CommandBufferProxyImpl* shared_command_buffer, | |
109 const gpu::gles2::ContextCreationAttribHelper& attributes, | |
110 command_buffer_metrics::ContextType context_type); | |
111 | |
112 void Destroy(); | |
113 | |
114 bool CreateContext(const gpu::SharedMemoryLimits& memory_limits, | |
115 gpu::CommandBufferProxyImpl* shared_command_buffer, | |
116 scoped_refptr<gpu::gles2::ShareGroup> share_group, | |
117 const gpu::gles2::ContextCreationAttribHelper& attributes, | |
118 command_buffer_metrics::ContextType context_type); | |
119 | |
120 void OnContextLost(); | 101 void OnContextLost(); |
121 | 102 |
122 bool initialized_ = false; | |
123 bool initialize_failed_ = false; | |
124 WebGraphicsContextLostCallback* context_lost_callback_ = nullptr; | 103 WebGraphicsContextLostCallback* context_lost_callback_ = nullptr; |
125 | 104 |
126 bool automatic_flushes_; | 105 bool automatic_flushes_; |
127 | |
128 // State needed by MaybeInitializeGL. | |
129 scoped_refptr<gpu::GpuChannelHost> host_; | |
130 gpu::SurfaceHandle surface_handle_; | 106 gpu::SurfaceHandle surface_handle_; |
131 GURL active_url_; | 107 GURL active_url_; |
132 | |
133 gfx::GpuPreference gpu_preference_; | 108 gfx::GpuPreference gpu_preference_; |
134 | 109 |
110 scoped_refptr<gpu::GpuChannelHost> host_; | |
135 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 111 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
136 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 112 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
137 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 113 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
138 std::unique_ptr<gpu::gles2::GLES2Implementation> real_gl_; | 114 std::unique_ptr<gpu::gles2::GLES2Implementation> real_gl_; |
139 std::unique_ptr<gpu::gles2::GLES2Interface> trace_gl_; | 115 std::unique_ptr<gpu::gles2::GLES2Interface> trace_gl_; |
140 | |
141 // Member variables should appear before the WeakPtrFactory, to ensure | |
142 // that any WeakPtrs to Controller are invalidated before its members | |
143 // variable's destructors are executed, rendering them invalid. | |
144 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; | |
danakj
2016/04/30 01:56:39
This was just unused.
| |
145 }; | 116 }; |
146 | 117 |
147 } // namespace content | 118 } // namespace content |
148 | 119 |
149 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 120 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |