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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 visible(visible), | 95 visible(visible), |
96 client_has_memory_allocation_changed_callback(false), | 96 client_has_memory_allocation_changed_callback(false), |
97 last_used_time(last_used_time) { | 97 last_used_time(last_used_time) { |
98 } | 98 } |
99 | 99 |
100 GpuCommandBufferStub::GpuCommandBufferStub( | 100 GpuCommandBufferStub::GpuCommandBufferStub( |
101 GpuChannel* channel, | 101 GpuChannel* channel, |
102 GpuCommandBufferStub* share_group, | 102 GpuCommandBufferStub* share_group, |
103 const gfx::GLSurfaceHandle& handle, | 103 const gfx::GLSurfaceHandle& handle, |
104 gpu::gles2::MailboxManager* mailbox_manager, | 104 gpu::gles2::MailboxManager* mailbox_manager, |
| 105 gpu::gles2::ImageManager* image_manager, |
105 const gfx::Size& size, | 106 const gfx::Size& size, |
106 const gpu::gles2::DisallowedFeatures& disallowed_features, | 107 const gpu::gles2::DisallowedFeatures& disallowed_features, |
107 const std::string& allowed_extensions, | 108 const std::string& allowed_extensions, |
108 const std::vector<int32>& attribs, | 109 const std::vector<int32>& attribs, |
109 gfx::GpuPreference gpu_preference, | 110 gfx::GpuPreference gpu_preference, |
110 int32 route_id, | 111 int32 route_id, |
111 int32 surface_id, | 112 int32 surface_id, |
112 GpuWatchdog* watchdog, | 113 GpuWatchdog* watchdog, |
113 bool software, | 114 bool software, |
114 const GURL& active_url) | 115 const GURL& active_url) |
(...skipping 14 matching lines...) Expand all Loading... |
129 sync_point_wait_count_(0), | 130 sync_point_wait_count_(0), |
130 delayed_work_scheduled_(false), | 131 delayed_work_scheduled_(false), |
131 active_url_(active_url) { | 132 active_url_(active_url) { |
132 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); | 133 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); |
133 FastSetActiveURL(active_url_, active_url_hash_); | 134 FastSetActiveURL(active_url_, active_url_hash_); |
134 if (share_group) { | 135 if (share_group) { |
135 context_group_ = share_group->context_group_; | 136 context_group_ = share_group->context_group_; |
136 } else { | 137 } else { |
137 context_group_ = new gpu::gles2::ContextGroup( | 138 context_group_ = new gpu::gles2::ContextGroup( |
138 mailbox_manager, | 139 mailbox_manager, |
| 140 image_manager, |
139 new GpuCommandBufferMemoryTracker(channel), | 141 new GpuCommandBufferMemoryTracker(channel), |
140 true); | 142 true); |
141 } | 143 } |
142 memory_manager_state_.reset(new GpuCommandBufferStubBase::MemoryManagerState( | 144 memory_manager_state_.reset(new GpuCommandBufferStubBase::MemoryManagerState( |
143 surface_id != 0, true, base::TimeTicks::Now())); | 145 surface_id != 0, true, base::TimeTicks::Now())); |
144 if (handle_.sync_point) | 146 if (handle_.sync_point) |
145 OnWaitSyncPoint(handle_.sync_point); | 147 OnWaitSyncPoint(handle_.sync_point); |
146 } | 148 } |
147 | 149 |
148 GpuCommandBufferStub::~GpuCommandBufferStub() { | 150 GpuCommandBufferStub::~GpuCommandBufferStub() { |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 const GpuMemoryAllocation& allocation) { | 838 const GpuMemoryAllocation& allocation) { |
837 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 839 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
838 // This can be called outside of OnMessageReceived, so the context needs to be | 840 // This can be called outside of OnMessageReceived, so the context needs to be |
839 // made current before calling methods on the surface. | 841 // made current before calling methods on the surface. |
840 if (!surface_ || !MakeCurrent()) | 842 if (!surface_ || !MakeCurrent()) |
841 return; | 843 return; |
842 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 844 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
843 } | 845 } |
844 | 846 |
845 #endif // defined(ENABLE_GPU) | 847 #endif // defined(ENABLE_GPU) |
OLD | NEW |