| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 const std::vector<int32>& attribs, | 295 const std::vector<int32>& attribs, |
| 296 gfx::GpuPreference gpu_preference, | 296 gfx::GpuPreference gpu_preference, |
| 297 const base::Closure& context_lost_callback, | 297 const base::Closure& context_lost_callback, |
| 298 unsigned int share_group_id) { | 298 unsigned int share_group_id) { |
| 299 | 299 |
| 300 share_resources_ = share_resources; | 300 share_resources_ = share_resources; |
| 301 context_lost_callback_ = WrapCallback(context_lost_callback); | 301 context_lost_callback_ = WrapCallback(context_lost_callback); |
| 302 share_group_id_ = share_group_id; | 302 share_group_id_ = share_group_id; |
| 303 | 303 |
| 304 base::WaitableEvent completion(true, false); | 304 base::WaitableEvent completion(true, false); |
| 305 bool result; | 305 bool result = false; |
| 306 base::Callback<bool(void)> init_task = | 306 base::Callback<bool(void)> init_task = |
| 307 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, | 307 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, |
| 308 base::Unretained(this), | 308 base::Unretained(this), |
| 309 is_offscreen, | 309 is_offscreen, |
| 310 window, | 310 window, |
| 311 size, | 311 size, |
| 312 allowed_extensions, | 312 allowed_extensions, |
| 313 attribs, | 313 attribs, |
| 314 gpu_preference); | 314 gpu_preference); |
| 315 QueueTask( | 315 QueueTask( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 if (share_resources_) { | 447 if (share_resources_) { |
| 448 g_all_shared_contexts.Pointer()->insert(this); | 448 g_all_shared_contexts.Pointer()->insert(this); |
| 449 } | 449 } |
| 450 | 450 |
| 451 return true; | 451 return true; |
| 452 } | 452 } |
| 453 | 453 |
| 454 void InProcessCommandBuffer::Destroy() { | 454 void InProcessCommandBuffer::Destroy() { |
| 455 base::WaitableEvent completion(true, false); | 455 base::WaitableEvent completion(true, false); |
| 456 bool result; | 456 bool result = false; |
| 457 base::Callback<bool(void)> destroy_task = base::Bind( | 457 base::Callback<bool(void)> destroy_task = base::Bind( |
| 458 &InProcessCommandBuffer::DestroyOnGpuThread, base::Unretained(this)); | 458 &InProcessCommandBuffer::DestroyOnGpuThread, base::Unretained(this)); |
| 459 QueueTask( | 459 QueueTask( |
| 460 base::Bind(&RunTaskWithResult<bool>, destroy_task, &result, &completion)); | 460 base::Bind(&RunTaskWithResult<bool>, destroy_task, &result, &completion)); |
| 461 completion.Wait(); | 461 completion.Wait(); |
| 462 } | 462 } |
| 463 | 463 |
| 464 bool InProcessCommandBuffer::DestroyOnGpuThread() { | 464 bool InProcessCommandBuffer::DestroyOnGpuThread() { |
| 465 command_buffer_.reset(); | 465 command_buffer_.reset(); |
| 466 // Clean up GL resources if possible. | 466 // Clean up GL resources if possible. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 g_uses_explicit_scheduling = true; | 694 g_uses_explicit_scheduling = true; |
| 695 g_gpu_queue.Get().SetScheduleCallback(callback); | 695 g_gpu_queue.Get().SetScheduleCallback(callback); |
| 696 } | 696 } |
| 697 | 697 |
| 698 // static | 698 // static |
| 699 void InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread() { | 699 void InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread() { |
| 700 g_gpu_queue.Get().RunTasks(); | 700 g_gpu_queue.Get().RunTasks(); |
| 701 } | 701 } |
| 702 | 702 |
| 703 } // namespace gpu | 703 } // namespace gpu |
| OLD | NEW |