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 #include "gpu/command_buffer/client/gl_in_process_context.h" | 5 #include "gpu/command_buffer/client/gl_in_process_context.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 scoped_shared_context_lock.reset( | 153 scoped_shared_context_lock.reset( |
154 new base::AutoLock(g_all_shared_contexts_lock.Get())); | 154 new base::AutoLock(g_all_shared_contexts_lock.Get())); |
155 for (std::set<GLInProcessContextImpl*>::const_iterator it = | 155 for (std::set<GLInProcessContextImpl*>::const_iterator it = |
156 g_all_shared_contexts.Get().begin(); | 156 g_all_shared_contexts.Get().begin(); |
157 it != g_all_shared_contexts.Get().end(); | 157 it != g_all_shared_contexts.Get().end(); |
158 it++) { | 158 it++) { |
159 const GLInProcessContextImpl* context = *it; | 159 const GLInProcessContextImpl* context = *it; |
160 if (!context->context_lost_) { | 160 if (!context->context_lost_) { |
161 share_group = context->gles2_implementation_->share_group(); | 161 share_group = context->gles2_implementation_->share_group(); |
162 share_command_buffer = context->command_buffer_.get(); | 162 share_command_buffer = context->command_buffer_.get(); |
163 DCHECK(share_group); | 163 DCHECK(share_group.get()); |
164 DCHECK(share_command_buffer); | 164 DCHECK(share_command_buffer); |
165 break; | 165 break; |
166 } | 166 } |
167 } | 167 } |
168 } else if (share_context) { | 168 } else if (share_context) { |
169 GLInProcessContextImpl* impl = | 169 GLInProcessContextImpl* impl = |
170 static_cast<GLInProcessContextImpl*>(share_context); | 170 static_cast<GLInProcessContextImpl*>(share_context); |
171 share_group = impl->gles2_implementation_->share_group(); | 171 share_group = impl->gles2_implementation_->share_group(); |
172 share_command_buffer = impl->command_buffer_.get(); | 172 share_command_buffer = impl->command_buffer_.get(); |
173 DCHECK(share_group); | 173 DCHECK(share_group.get()); |
174 DCHECK(share_command_buffer); | 174 DCHECK(share_command_buffer); |
175 } | 175 } |
176 | 176 |
177 if (!command_buffer_->Initialize(surface, | 177 if (!command_buffer_->Initialize(surface, |
178 is_offscreen, | 178 is_offscreen, |
179 window, | 179 window, |
180 size, | 180 size, |
181 attrib_vector, | 181 attrib_vector, |
182 gpu_preference, | 182 gpu_preference, |
183 wrapped_callback, | 183 wrapped_callback, |
(...skipping 11 matching lines...) Expand all Loading... |
195 } | 195 } |
196 | 196 |
197 // Create a transfer buffer. | 197 // Create a transfer buffer. |
198 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); | 198 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); |
199 | 199 |
200 // Check for consistency. | 200 // Check for consistency. |
201 DCHECK(!attribs.bind_generates_resource); | 201 DCHECK(!attribs.bind_generates_resource); |
202 bool bind_generates_resource = false; | 202 bool bind_generates_resource = false; |
203 | 203 |
204 // Create the object exposing the OpenGL API. | 204 // Create the object exposing the OpenGL API. |
205 gles2_implementation_.reset(new gles2::GLES2Implementation( | 205 gles2_implementation_.reset( |
206 gles2_helper_.get(), | 206 new gles2::GLES2Implementation(gles2_helper_.get(), |
207 share_group, | 207 share_group.get(), |
208 transfer_buffer_.get(), | 208 transfer_buffer_.get(), |
209 bind_generates_resource, | 209 bind_generates_resource, |
210 attribs.lose_context_when_out_of_memory, | 210 attribs.lose_context_when_out_of_memory, |
211 command_buffer_.get())); | 211 command_buffer_.get())); |
212 | 212 |
213 if (use_global_share_group) { | 213 if (use_global_share_group) { |
214 g_all_shared_contexts.Get().insert(this); | 214 g_all_shared_contexts.Get().insert(this); |
215 scoped_shared_context_lock.reset(); | 215 scoped_shared_context_lock.reset(); |
216 } | 216 } |
217 | 217 |
218 if (!gles2_implementation_->Initialize( | 218 if (!gles2_implementation_->Initialize( |
219 mem_limits_.start_transfer_buffer_size, | 219 mem_limits_.start_transfer_buffer_size, |
220 mem_limits_.min_transfer_buffer_size, | 220 mem_limits_.min_transfer_buffer_size, |
221 mem_limits_.max_transfer_buffer_size, | 221 mem_limits_.max_transfer_buffer_size, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 size, | 289 size, |
290 attribs, | 290 attribs, |
291 gpu_preference, | 291 gpu_preference, |
292 service)) | 292 service)) |
293 return NULL; | 293 return NULL; |
294 | 294 |
295 return context.release(); | 295 return context.release(); |
296 } | 296 } |
297 | 297 |
298 } // namespace gpu | 298 } // namespace gpu |
OLD | NEW |