OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/gpu/client/context_provider_command_buffer.h" | 5 #include "content/common/gpu/client/context_provider_command_buffer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 if (lost_context_callback_proxy_) | 91 if (lost_context_callback_proxy_) |
92 return true; | 92 return true; |
93 | 93 |
94 if (!context3d_->InitializeOnCurrentThread()) | 94 if (!context3d_->InitializeOnCurrentThread()) |
95 return false; | 95 return false; |
96 | 96 |
97 InitializeCapabilities(); | 97 InitializeCapabilities(); |
98 | 98 |
99 std::string unique_context_name = | 99 std::string unique_context_name = |
100 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); | 100 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); |
101 context3d_->pushGroupMarkerEXT(unique_context_name.c_str()); | 101 context3d_->traceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); |
102 | 102 |
103 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); | 103 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); |
104 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( | 104 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
105 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, | 105 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, |
106 base::Unretained(this))); | 106 base::Unretained(this))); |
107 return true; | 107 return true; |
108 } | 108 } |
109 | 109 |
110 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { | 110 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { |
111 DCHECK(context3d_); | 111 DCHECK(context3d_); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); | 192 size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); |
193 caps.max_transfer_buffer_usage_bytes = | 193 caps.max_transfer_buffer_usage_bytes = |
194 mapped_memory_limit == WebGraphicsContext3DCommandBufferImpl::kNoLimit | 194 mapped_memory_limit == WebGraphicsContext3DCommandBufferImpl::kNoLimit |
195 ? std::numeric_limits<size_t>::max() : mapped_memory_limit; | 195 ? std::numeric_limits<size_t>::max() : mapped_memory_limit; |
196 | 196 |
197 capabilities_ = caps; | 197 capabilities_ = caps; |
198 } | 198 } |
199 | 199 |
200 bool ContextProviderCommandBuffer::DestroyedOnMainThread() { | 200 bool ContextProviderCommandBuffer::DestroyedOnMainThread() { |
201 DCHECK(main_thread_checker_.CalledOnValidThread()); | 201 DCHECK(main_thread_checker_.CalledOnValidThread()); |
202 context3d_->traceEndCHROMIUM(); | |
vmiura
2014/12/18 19:30:27
Likewise, can we just remove this call, as GL_CHRO
David Yen
2014/12/18 21:25:59
Done.
| |
202 | 203 |
203 base::AutoLock lock(main_thread_lock_); | 204 base::AutoLock lock(main_thread_lock_); |
204 return destroyed_; | 205 return destroyed_; |
205 } | 206 } |
206 | 207 |
207 void ContextProviderCommandBuffer::SetLostContextCallback( | 208 void ContextProviderCommandBuffer::SetLostContextCallback( |
208 const LostContextCallback& lost_context_callback) { | 209 const LostContextCallback& lost_context_callback) { |
209 DCHECK(context_thread_checker_.CalledOnValidThread()); | 210 DCHECK(context_thread_checker_.CalledOnValidThread()); |
210 DCHECK(lost_context_callback_.is_null() || | 211 DCHECK(lost_context_callback_.is_null() || |
211 lost_context_callback.is_null()); | 212 lost_context_callback.is_null()); |
212 lost_context_callback_ = lost_context_callback; | 213 lost_context_callback_ = lost_context_callback; |
213 } | 214 } |
214 | 215 |
215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 216 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 217 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
217 DCHECK(context_thread_checker_.CalledOnValidThread()); | 218 DCHECK(context_thread_checker_.CalledOnValidThread()); |
218 DCHECK(memory_policy_changed_callback_.is_null() || | 219 DCHECK(memory_policy_changed_callback_.is_null() || |
219 memory_policy_changed_callback.is_null()); | 220 memory_policy_changed_callback.is_null()); |
220 memory_policy_changed_callback_ = memory_policy_changed_callback; | 221 memory_policy_changed_callback_ = memory_policy_changed_callback; |
221 } | 222 } |
222 | 223 |
223 } // namespace content | 224 } // namespace content |
OLD | NEW |