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

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

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and add missing locks Created 5 years, 4 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
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void ContextProviderCommandBuffer::DeleteCachedResources() { 180 void ContextProviderCommandBuffer::DeleteCachedResources() {
181 DCHECK(context_thread_checker_.CalledOnValidThread()); 181 DCHECK(context_thread_checker_.CalledOnValidThread());
182 182
183 if (gr_context_) 183 if (gr_context_)
184 gr_context_->FreeGpuResources(); 184 gr_context_->FreeGpuResources();
185 } 185 }
186 186
187 void ContextProviderCommandBuffer::OnLostContext() { 187 void ContextProviderCommandBuffer::OnLostContext() {
188 base::AutoLock lock(context_lock_);
189
188 DCHECK(context_thread_checker_.CalledOnValidThread()); 190 DCHECK(context_thread_checker_.CalledOnValidThread());
189 { 191 {
190 base::AutoLock lock(main_thread_lock_); 192 base::AutoLock lock(main_thread_lock_);
191 if (destroyed_) 193 if (destroyed_)
192 return; 194 return;
193 destroyed_ = true; 195 destroyed_ = true;
194 } 196 }
195 if (!lost_context_callback_.is_null()) 197 if (!lost_context_callback_.is_null())
196 base::ResetAndReturn(&lost_context_callback_).Run(); 198 base::ResetAndReturn(&lost_context_callback_).Run();
197 if (gr_context_) 199 if (gr_context_)
198 gr_context_->OnLostContext(); 200 gr_context_->OnLostContext();
199 } 201 }
200 202
201 void ContextProviderCommandBuffer::OnMemoryAllocationChanged( 203 void ContextProviderCommandBuffer::OnMemoryAllocationChanged(
202 const gpu::MemoryAllocation& allocation) { 204 const gpu::MemoryAllocation& allocation) {
205 base::AutoLock lock(context_lock_);
206
203 DCHECK(context_thread_checker_.CalledOnValidThread()); 207 DCHECK(context_thread_checker_.CalledOnValidThread());
204 208
205 if (memory_policy_changed_callback_.is_null()) 209 if (memory_policy_changed_callback_.is_null())
206 return; 210 return;
207 211
208 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation)); 212 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation));
209 } 213 }
210 214
211 void ContextProviderCommandBuffer::InitializeCapabilities() { 215 void ContextProviderCommandBuffer::InitializeCapabilities() {
212 Capabilities caps; 216 Capabilities caps;
(...skipping 24 matching lines...) Expand all
237 241
238 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( 242 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback(
239 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 243 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
240 DCHECK(context_thread_checker_.CalledOnValidThread()); 244 DCHECK(context_thread_checker_.CalledOnValidThread());
241 DCHECK(memory_policy_changed_callback_.is_null() || 245 DCHECK(memory_policy_changed_callback_.is_null() ||
242 memory_policy_changed_callback.is_null()); 246 memory_policy_changed_callback.is_null());
243 memory_policy_changed_callback_ = memory_policy_changed_callback; 247 memory_policy_changed_callback_ = memory_policy_changed_callback;
244 } 248 }
245 249
246 } // namespace content 250 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698