Chromium Code Reviews| 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 "webkit/common/gpu/context_provider_in_process.h" | 5 #include "webkit/common/gpu/context_provider_in_process.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 if (lost_context_callback_proxy_) | 95 if (lost_context_callback_proxy_) |
| 96 return true; | 96 return true; |
| 97 | 97 |
| 98 if (!context3d_->InitializeOnCurrentThread()) | 98 if (!context3d_->InitializeOnCurrentThread()) |
| 99 return false; | 99 return false; |
| 100 | 100 |
| 101 InitializeCapabilities(); | 101 InitializeCapabilities(); |
| 102 | 102 |
| 103 std::string unique_context_name = | 103 std::string unique_context_name = |
| 104 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); | 104 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); |
| 105 context3d_->pushGroupMarkerEXT(unique_context_name.c_str()); | 105 context3d_->traceBeginCHROMIUM("gpu_toplevel", |
| 106 unique_context_name.c_str()); | |
|
Ken Russell (switch to Gerrit)
2014/12/17 23:56:10
I'll have to defer to Victor's review on whether i
vmiura
2014/12/18 02:38:52
I think this is fine.
| |
| 106 | 107 |
| 107 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); | 108 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); |
| 108 return true; | 109 return true; |
| 109 } | 110 } |
| 110 | 111 |
| 111 void ContextProviderInProcess::InitializeCapabilities() { | 112 void ContextProviderInProcess::InitializeCapabilities() { |
| 112 capabilities_.gpu = context3d_->GetImplementation()->capabilities(); | 113 capabilities_.gpu = context3d_->GetImplementation()->capabilities(); |
| 113 | 114 |
| 114 size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); | 115 size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); |
| 115 capabilities_.max_transfer_buffer_usage_bytes = | 116 capabilities_.max_transfer_buffer_usage_bytes = |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 destroyed_ = true; | 188 destroyed_ = true; |
| 188 } | 189 } |
| 189 if (!lost_context_callback_.is_null()) | 190 if (!lost_context_callback_.is_null()) |
| 190 base::ResetAndReturn(&lost_context_callback_).Run(); | 191 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 191 if (gr_context_) | 192 if (gr_context_) |
| 192 gr_context_->OnLostContext(); | 193 gr_context_->OnLostContext(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 bool ContextProviderInProcess::DestroyedOnMainThread() { | 196 bool ContextProviderInProcess::DestroyedOnMainThread() { |
| 196 DCHECK(main_thread_checker_.CalledOnValidThread()); | 197 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 198 context3d_->traceEndCHROMIUM(); | |
|
Ken Russell (switch to Gerrit)
2014/12/17 23:56:10
Similarly it's not obvious to me that calling this
vmiura
2014/12/18 02:38:52
It is not necessarily needed, as the End is implie
Ken Russell (switch to Gerrit)
2014/12/18 19:03:56
Wait a second. Looking more closely, this method i
vmiura
2014/12/18 19:30:27
Can we just remove this call David, as GL_CHROMIUM
David Yen
2014/12/18 21:25:59
Done.
| |
| 197 | 199 |
| 198 base::AutoLock lock(destroyed_lock_); | 200 base::AutoLock lock(destroyed_lock_); |
| 199 return destroyed_; | 201 return destroyed_; |
| 200 } | 202 } |
| 201 | 203 |
| 202 void ContextProviderInProcess::SetLostContextCallback( | 204 void ContextProviderInProcess::SetLostContextCallback( |
| 203 const LostContextCallback& lost_context_callback) { | 205 const LostContextCallback& lost_context_callback) { |
| 204 DCHECK(context_thread_checker_.CalledOnValidThread()); | 206 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 205 DCHECK(lost_context_callback_.is_null() || | 207 DCHECK(lost_context_callback_.is_null() || |
| 206 lost_context_callback.is_null()); | 208 lost_context_callback.is_null()); |
| 207 lost_context_callback_ = lost_context_callback; | 209 lost_context_callback_ = lost_context_callback; |
| 208 } | 210 } |
| 209 | 211 |
| 210 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 212 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
| 211 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 213 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 212 // There's no memory manager for the in-process implementation. | 214 // There's no memory manager for the in-process implementation. |
| 213 } | 215 } |
| 214 | 216 |
| 215 } // namespace gpu | 217 } // namespace gpu |
| 216 } // namespace webkit | 218 } // namespace webkit |
| OLD | NEW |