OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return gfx::GpuMemoryBufferHandle(); | 231 return gfx::GpuMemoryBufferHandle(); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 } // anonyous namespace | 235 } // anonyous namespace |
236 | 236 |
237 InProcessCommandBuffer::Service::Service() {} | 237 InProcessCommandBuffer::Service::Service() {} |
238 | 238 |
239 InProcessCommandBuffer::Service::~Service() {} | 239 InProcessCommandBuffer::Service::~Service() {} |
240 | 240 |
| 241 scoped_refptr<gfx::GLShareGroup> |
| 242 InProcessCommandBuffer::Service::share_group() { |
| 243 if (!share_group_.get()) |
| 244 share_group_ = new gfx::GLShareGroup; |
| 245 return share_group_; |
| 246 } |
| 247 |
241 scoped_refptr<gles2::MailboxManager> | 248 scoped_refptr<gles2::MailboxManager> |
242 InProcessCommandBuffer::Service::mailbox_manager() { | 249 InProcessCommandBuffer::Service::mailbox_manager() { |
243 if (!mailbox_manager_.get()) { | 250 if (!mailbox_manager_.get()) { |
244 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 251 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
245 switches::kEnableThreadedTextureMailboxes)) { | 252 switches::kEnableThreadedTextureMailboxes)) { |
246 mailbox_manager_ = new gles2::MailboxManagerSync(); | 253 mailbox_manager_ = new gles2::MailboxManagerSync(); |
247 } else { | 254 } else { |
248 mailbox_manager_ = new gles2::MailboxManagerImpl(); | 255 mailbox_manager_ = new gles2::MailboxManagerImpl(); |
249 } | 256 } |
250 } | 257 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 command_buffer->SetParseErrorCallback(base::Bind( | 397 command_buffer->SetParseErrorCallback(base::Bind( |
391 &InProcessCommandBuffer::OnContextLost, gpu_thread_weak_ptr_)); | 398 &InProcessCommandBuffer::OnContextLost, gpu_thread_weak_ptr_)); |
392 | 399 |
393 if (!command_buffer->Initialize()) { | 400 if (!command_buffer->Initialize()) { |
394 LOG(ERROR) << "Could not initialize command buffer."; | 401 LOG(ERROR) << "Could not initialize command buffer."; |
395 DestroyOnGpuThread(); | 402 DestroyOnGpuThread(); |
396 return false; | 403 return false; |
397 } | 404 } |
398 | 405 |
399 gl_share_group_ = params.context_group | 406 gl_share_group_ = params.context_group |
400 ? params.context_group->gl_share_group_.get() | 407 ? params.context_group->gl_share_group_ |
401 : new gfx::GLShareGroup; | 408 : service_->share_group(); |
402 | 409 |
403 #if defined(OS_ANDROID) | 410 #if defined(OS_ANDROID) |
404 stream_texture_manager_.reset(new StreamTextureManagerInProcess); | 411 stream_texture_manager_.reset(new StreamTextureManagerInProcess); |
405 #endif | 412 #endif |
406 | 413 |
407 bool bind_generates_resource = false; | 414 bool bind_generates_resource = false; |
408 decoder_.reset(gles2::GLES2Decoder::Create( | 415 decoder_.reset(gles2::GLES2Decoder::Create( |
409 params.context_group | 416 params.context_group |
410 ? params.context_group->decoder_->GetContextGroup() | 417 ? params.context_group->decoder_->GetContextGroup() |
411 : new gles2::ContextGroup(service_->mailbox_manager(), | 418 : new gles2::ContextGroup(service_->mailbox_manager(), |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 | 956 |
950 #if defined(OS_ANDROID) | 957 #if defined(OS_ANDROID) |
951 scoped_refptr<gfx::SurfaceTexture> | 958 scoped_refptr<gfx::SurfaceTexture> |
952 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 959 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { |
953 DCHECK(stream_texture_manager_); | 960 DCHECK(stream_texture_manager_); |
954 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 961 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
955 } | 962 } |
956 #endif | 963 #endif |
957 | 964 |
958 } // namespace gpu | 965 } // namespace gpu |
OLD | NEW |