| 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const gfx::GLSurfaceHandle& handle, | 42 const gfx::GLSurfaceHandle& handle, |
| 43 gpu::gles2::MailboxManager* mailbox_manager, | 43 gpu::gles2::MailboxManager* mailbox_manager, |
| 44 const gfx::Size& size, | 44 const gfx::Size& size, |
| 45 const gpu::gles2::DisallowedFeatures& disallowed_features, | 45 const gpu::gles2::DisallowedFeatures& disallowed_features, |
| 46 const std::string& allowed_extensions, | 46 const std::string& allowed_extensions, |
| 47 const std::vector<int32>& attribs, | 47 const std::vector<int32>& attribs, |
| 48 gfx::GpuPreference gpu_preference, | 48 gfx::GpuPreference gpu_preference, |
| 49 int32 route_id, | 49 int32 route_id, |
| 50 int32 surface_id, | 50 int32 surface_id, |
| 51 GpuWatchdog* watchdog, | 51 GpuWatchdog* watchdog, |
| 52 bool software) | 52 bool software, |
| 53 gpu::gles2::ProgramCache* program_cache) |
| 53 : channel_(channel), | 54 : channel_(channel), |
| 54 handle_(handle), | 55 handle_(handle), |
| 55 initial_size_(size), | 56 initial_size_(size), |
| 56 disallowed_features_(disallowed_features), | 57 disallowed_features_(disallowed_features), |
| 57 allowed_extensions_(allowed_extensions), | 58 allowed_extensions_(allowed_extensions), |
| 58 requested_attribs_(attribs), | 59 requested_attribs_(attribs), |
| 59 gpu_preference_(gpu_preference), | 60 gpu_preference_(gpu_preference), |
| 60 route_id_(route_id), | 61 route_id_(route_id), |
| 61 software_(software), | 62 software_(software), |
| 62 client_has_memory_allocation_changed_callback_(false), | 63 client_has_memory_allocation_changed_callback_(false), |
| 63 last_flush_count_(0), | 64 last_flush_count_(0), |
| 64 parent_stub_for_initialization_(), | 65 parent_stub_for_initialization_(), |
| 65 parent_texture_for_initialization_(0), | 66 parent_texture_for_initialization_(0), |
| 66 watchdog_(watchdog), | 67 watchdog_(watchdog), |
| 67 sync_point_wait_count_(0) { | 68 sync_point_wait_count_(0) { |
| 68 if (share_group) { | 69 if (share_group) { |
| 69 context_group_ = share_group->context_group_; | 70 context_group_ = share_group->context_group_; |
| 70 } else { | 71 } else { |
| 71 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, true); | 72 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, |
| 73 true, |
| 74 program_cache); |
| 72 } | 75 } |
| 73 if (surface_id != 0) | 76 if (surface_id != 0) |
| 74 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( | 77 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( |
| 75 surface_id, true, base::TimeTicks::Now())); | 78 surface_id, true, base::TimeTicks::Now())); |
| 76 if (handle_.sync_point) | 79 if (handle_.sync_point) |
| 77 OnWaitSyncPoint(handle_.sync_point); | 80 OnWaitSyncPoint(handle_.sync_point); |
| 78 } | 81 } |
| 79 | 82 |
| 80 GpuCommandBufferStub::~GpuCommandBufferStub() { | 83 GpuCommandBufferStub::~GpuCommandBufferStub() { |
| 81 Destroy(); | 84 Destroy(); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 const GpuMemoryAllocation& allocation) { | 743 const GpuMemoryAllocation& allocation) { |
| 741 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 744 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
| 742 // This can be called outside of OnMessageReceived, so the context needs to be | 745 // This can be called outside of OnMessageReceived, so the context needs to be |
| 743 // made current before calling methods on the surface. | 746 // made current before calling methods on the surface. |
| 744 if (!surface_ || !MakeCurrent()) | 747 if (!surface_ || !MakeCurrent()) |
| 745 return; | 748 return; |
| 746 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 749 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
| 747 } | 750 } |
| 748 | 751 |
| 749 #endif // defined(ENABLE_GPU) | 752 #endif // defined(ENABLE_GPU) |
| OLD | NEW |