| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return context3d_.get(); | 84 return context3d_.get(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool ContextProviderCommandBuffer::BindToCurrentThread() { | 87 bool ContextProviderCommandBuffer::BindToCurrentThread() { |
| 88 // This is called on the thread the context will be used. | 88 // This is called on the thread the context will be used. |
| 89 DCHECK(context_thread_checker_.CalledOnValidThread()); | 89 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 90 | 90 |
| 91 if (lost_context_callback_proxy_) | 91 if (lost_context_callback_proxy_) |
| 92 return true; | 92 return true; |
| 93 | 93 |
| 94 if (!context3d_->makeContextCurrent()) | 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_->pushGroupMarkerEXT(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( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
| 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 217 DCHECK(context_thread_checker_.CalledOnValidThread()); | 217 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 218 DCHECK(memory_policy_changed_callback_.is_null() || | 218 DCHECK(memory_policy_changed_callback_.is_null() || |
| 219 memory_policy_changed_callback.is_null()); | 219 memory_policy_changed_callback.is_null()); |
| 220 memory_policy_changed_callback_ = memory_policy_changed_callback; | 220 memory_policy_changed_callback_ = memory_policy_changed_callback; |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace content | 223 } // namespace content |
| OLD | NEW |