| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 gpu::gles2::MailboxManager* mailbox_manager, | 72 gpu::gles2::MailboxManager* mailbox_manager, |
| 73 const gfx::Size& size, | 73 const gfx::Size& size, |
| 74 const gpu::gles2::DisallowedFeatures& disallowed_features, | 74 const gpu::gles2::DisallowedFeatures& disallowed_features, |
| 75 const std::string& allowed_extensions, | 75 const std::string& allowed_extensions, |
| 76 const std::vector<int32>& attribs, | 76 const std::vector<int32>& attribs, |
| 77 gfx::GpuPreference gpu_preference, | 77 gfx::GpuPreference gpu_preference, |
| 78 int32 route_id, | 78 int32 route_id, |
| 79 int32 surface_id, | 79 int32 surface_id, |
| 80 GpuWatchdog* watchdog, | 80 GpuWatchdog* watchdog, |
| 81 bool software, | 81 bool software, |
| 82 const GURL& active_url, | 82 const GURL& active_url) |
| 83 gpu::gles2::ProgramCache* program_cache) | |
| 84 : channel_(channel), | 83 : channel_(channel), |
| 85 handle_(handle), | 84 handle_(handle), |
| 86 initial_size_(size), | 85 initial_size_(size), |
| 87 disallowed_features_(disallowed_features), | 86 disallowed_features_(disallowed_features), |
| 88 allowed_extensions_(allowed_extensions), | 87 allowed_extensions_(allowed_extensions), |
| 89 requested_attribs_(attribs), | 88 requested_attribs_(attribs), |
| 90 gpu_preference_(gpu_preference), | 89 gpu_preference_(gpu_preference), |
| 91 route_id_(route_id), | 90 route_id_(route_id), |
| 92 software_(software), | 91 software_(software), |
| 93 client_has_memory_allocation_changed_callback_(false), | 92 client_has_memory_allocation_changed_callback_(false), |
| 94 last_flush_count_(0), | 93 last_flush_count_(0), |
| 95 parent_stub_for_initialization_(), | 94 parent_stub_for_initialization_(), |
| 96 parent_texture_for_initialization_(0), | 95 parent_texture_for_initialization_(0), |
| 97 watchdog_(watchdog), | 96 watchdog_(watchdog), |
| 98 sync_point_wait_count_(0), | 97 sync_point_wait_count_(0), |
| 99 delayed_work_scheduled_(false), | 98 delayed_work_scheduled_(false), |
| 100 active_url_(active_url) { | 99 active_url_(active_url) { |
| 101 active_url_hash_ = | 100 active_url_hash_ = |
| 102 disk_cache::Hash(active_url.possibly_invalid_spec()); | 101 disk_cache::Hash(active_url.possibly_invalid_spec()); |
| 103 FastSetActiveURL(active_url_, active_url_hash_); | 102 FastSetActiveURL(active_url_, active_url_hash_); |
| 104 if (share_group) { | 103 if (share_group) { |
| 105 context_group_ = share_group->context_group_; | 104 context_group_ = share_group->context_group_; |
| 106 } else { | 105 } else { |
| 107 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, | 106 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, true); |
| 108 true, | |
| 109 program_cache); | |
| 110 } | 107 } |
| 111 if (surface_id != 0) | 108 if (surface_id != 0) |
| 112 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( | 109 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( |
| 113 surface_id, true, base::TimeTicks::Now())); | 110 surface_id, true, base::TimeTicks::Now())); |
| 114 if (handle_.sync_point) | 111 if (handle_.sync_point) |
| 115 OnWaitSyncPoint(handle_.sync_point); | 112 OnWaitSyncPoint(handle_.sync_point); |
| 116 } | 113 } |
| 117 | 114 |
| 118 GpuCommandBufferStub::~GpuCommandBufferStub() { | 115 GpuCommandBufferStub::~GpuCommandBufferStub() { |
| 119 Destroy(); | 116 Destroy(); |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 const GpuMemoryAllocation& allocation) { | 797 const GpuMemoryAllocation& allocation) { |
| 801 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 798 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
| 802 // This can be called outside of OnMessageReceived, so the context needs to be | 799 // This can be called outside of OnMessageReceived, so the context needs to be |
| 803 // made current before calling methods on the surface. | 800 // made current before calling methods on the surface. |
| 804 if (!surface_ || !MakeCurrent()) | 801 if (!surface_ || !MakeCurrent()) |
| 805 return; | 802 return; |
| 806 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 803 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
| 807 } | 804 } |
| 808 | 805 |
| 809 #endif // defined(ENABLE_GPU) | 806 #endif // defined(ENABLE_GPU) |
| OLD | NEW |