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

Side by Side Diff: cc/test/test_context_provider.cc

Issue 1131723002: Add ContextProvider::InvalidateGrContext to reset GL state in GrContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix int/uint typo 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/test/test_context_provider.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/test/test_context_provider.h" 5 #include "cc/test/test_context_provider.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 gr_context_ = skia::AdoptRef(GrContext::Create( 105 gr_context_ = skia::AdoptRef(GrContext::Create(
106 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(gl_context->gl()))); 106 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(gl_context->gl())));
107 107
108 // If GlContext is already lost, also abandon the new GrContext. 108 // If GlContext is already lost, also abandon the new GrContext.
109 if (IsContextLost()) 109 if (IsContextLost())
110 gr_context_->abandonContext(); 110 gr_context_->abandonContext();
111 111
112 return gr_context_.get(); 112 return gr_context_.get();
113 } 113 }
114 114
115 void TestContextProvider::InvalidateGrContext(uint32_t state) {
116 DCHECK(bound_);
117 DCHECK(context_thread_checker_.CalledOnValidThread());
118
119 if (gr_context_)
120 gr_context_.get()->resetContext(state);
danakj 2015/10/13 22:55:54 foo_.get()->bar() should be written foo_->bar()
121 }
122
115 void TestContextProvider::SetupLock() { 123 void TestContextProvider::SetupLock() {
116 } 124 }
117 125
118 base::Lock* TestContextProvider::GetLock() { 126 base::Lock* TestContextProvider::GetLock() {
119 return &context_lock_; 127 return &context_lock_;
120 } 128 }
121 129
122 bool TestContextProvider::IsContextLost() { 130 bool TestContextProvider::IsContextLost() {
123 DCHECK(bound_); 131 DCHECK(bound_);
124 DCHECK(context_thread_checker_.CalledOnValidThread()); 132 DCHECK(context_thread_checker_.CalledOnValidThread());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); 199 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null());
192 memory_policy_changed_callback_ = cb; 200 memory_policy_changed_callback_ = cb;
193 } 201 }
194 202
195 void TestContextProvider::SetMaxTransferBufferUsageBytes( 203 void TestContextProvider::SetMaxTransferBufferUsageBytes(
196 size_t max_transfer_buffer_usage_bytes) { 204 size_t max_transfer_buffer_usage_bytes) {
197 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); 205 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes);
198 } 206 }
199 207
200 } // namespace cc 208 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_context_provider.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698