Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 126093010: Use ContextProvider subclass to provide WGC3D pointers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 81
82 CommandBufferProxyImpl* ContextProviderCommandBuffer::GetCommandBufferProxy() { 82 CommandBufferProxyImpl* ContextProviderCommandBuffer::GetCommandBufferProxy() {
83 return context3d_->GetCommandBufferProxy(); 83 return context3d_->GetCommandBufferProxy();
84 } 84 }
85 85
86 int ContextProviderCommandBuffer::GetGPUProcessID() { 86 int ContextProviderCommandBuffer::GetGPUProcessID() {
87 return context3d_->GetGPUProcessID(); 87 return context3d_->GetGPUProcessID();
88 } 88 }
89 89
90 WebGraphicsContext3DCommandBufferImpl*
91 ContextProviderCommandBuffer::WebContext3D() {
92 DCHECK(context3d_);
93 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
94 DCHECK(context_thread_checker_.CalledOnValidThread());
95
96 return context3d_.get();
97 }
98
90 bool ContextProviderCommandBuffer::BindToCurrentThread() { 99 bool ContextProviderCommandBuffer::BindToCurrentThread() {
91 // This is called on the thread the context will be used. 100 // This is called on the thread the context will be used.
92 DCHECK(context_thread_checker_.CalledOnValidThread()); 101 DCHECK(context_thread_checker_.CalledOnValidThread());
93 102
94 if (lost_context_callback_proxy_) 103 if (lost_context_callback_proxy_)
95 return true; 104 return true;
96 105
97 if (!context3d_->makeContextCurrent()) 106 if (!context3d_->makeContextCurrent())
98 return false; 107 return false;
99 108
100 InitializeCapabilities(); 109 InitializeCapabilities();
101 110
102 std::string unique_context_name = 111 std::string unique_context_name =
103 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); 112 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get());
104 context3d_->pushGroupMarkerEXT(unique_context_name.c_str()); 113 context3d_->pushGroupMarkerEXT(unique_context_name.c_str());
105 114
106 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); 115 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this));
107 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( 116 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback(
108 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, 117 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged,
109 base::Unretained(this))); 118 base::Unretained(this)));
110 return true; 119 return true;
111 } 120 }
112 121
113 WebGraphicsContext3DCommandBufferImpl* 122 blink::WebGraphicsContext3D* ContextProviderCommandBuffer::Context3d() {
114 ContextProviderCommandBuffer::Context3d() { 123 return NULL;
115 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
116 DCHECK(context_thread_checker_.CalledOnValidThread());
117
118 return context3d_.get();
119 } 124 }
120 125
121 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { 126 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() {
122 DCHECK(context3d_); 127 DCHECK(context3d_);
123 DCHECK(lost_context_callback_proxy_); // Is bound to thread. 128 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
124 DCHECK(context_thread_checker_.CalledOnValidThread()); 129 DCHECK(context_thread_checker_.CalledOnValidThread());
125 130
126 return context3d_->GetImplementation(); 131 return context3d_->GetImplementation();
127 } 132 }
128 133
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 235
231 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( 236 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback(
232 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 237 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
233 DCHECK(context_thread_checker_.CalledOnValidThread()); 238 DCHECK(context_thread_checker_.CalledOnValidThread());
234 DCHECK(memory_policy_changed_callback_.is_null() || 239 DCHECK(memory_policy_changed_callback_.is_null() ||
235 memory_policy_changed_callback.is_null()); 240 memory_policy_changed_callback.is_null());
236 memory_policy_changed_callback_ = memory_policy_changed_callback; 241 memory_policy_changed_callback_ = memory_policy_changed_callback;
237 } 242 }
238 243
239 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.h ('k') | content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698