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

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

Issue 1135743004: cc: Add null checks for GrContext created by ContextProviderCommandBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Worker context provider's lock must be held during GrContext creation. Created 5 years, 7 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 class GrContext* ContextProviderCommandBuffer::GrContext() { 130 class GrContext* ContextProviderCommandBuffer::GrContext() {
131 DCHECK(lost_context_callback_proxy_); // Is bound to thread. 131 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
132 DCHECK(context_thread_checker_.CalledOnValidThread()); 132 DCHECK(context_thread_checker_.CalledOnValidThread());
133 133
134 if (gr_context_) 134 if (gr_context_)
135 return gr_context_->get(); 135 return gr_context_->get();
136 136
137 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); 137 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get()));
138 138
139 // If GlContext is already lost, also abandon the new GrContext. 139 // If GlContext is already lost, also abandon the new GrContext.
140 if (IsContextLost()) 140 if (gr_context_->get() && IsContextLost())
141 gr_context_->get()->abandonContext(); 141 gr_context_->get()->abandonContext();
142 142
143 return gr_context_->get(); 143 return gr_context_->get();
144 } 144 }
145 145
146 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) { 146 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) {
147 if (gr_context_) { 147 if (gr_context_) {
148 DCHECK(lost_context_callback_proxy_); // Is bound to thread. 148 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
149 DCHECK(context_thread_checker_.CalledOnValidThread()); 149 DCHECK(context_thread_checker_.CalledOnValidThread());
150 gr_context_->get()->resetContext(state); 150 gr_context_->get()->resetContext(state);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( 244 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback(
245 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 245 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
246 DCHECK(context_thread_checker_.CalledOnValidThread()); 246 DCHECK(context_thread_checker_.CalledOnValidThread());
247 DCHECK(memory_policy_changed_callback_.is_null() || 247 DCHECK(memory_policy_changed_callback_.is_null() ||
248 memory_policy_changed_callback.is_null()); 248 memory_policy_changed_callback.is_null());
249 memory_policy_changed_callback_ = memory_policy_changed_callback; 249 memory_policy_changed_callback_ = memory_policy_changed_callback;
250 } 250 }
251 251
252 } // namespace content 252 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698