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

Side by Side Diff: android_webview/browser/aw_render_thread_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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "android_webview/browser/aw_render_thread_context_provider.h" 5 #include "android_webview/browser/aw_render_thread_context_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); 135 skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding());
136 interface->fCallback = BindGrContextCallback; 136 interface->fCallback = BindGrContextCallback;
137 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); 137 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
138 138
139 gr_context_ = skia::AdoptRef(GrContext::Create( 139 gr_context_ = skia::AdoptRef(GrContext::Create(
140 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); 140 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
141 141
142 return gr_context_.get(); 142 return gr_context_.get();
143 } 143 }
144 144
145 void AwRenderThreadContextProvider::InvalidateGrContext(uint32_t state) {
146 DCHECK(main_thread_checker_.CalledOnValidThread());
147
148 if (gr_context_)
149 gr_context_.get()->resetContext(state);
150 }
151
145 void AwRenderThreadContextProvider::SetupLock() { 152 void AwRenderThreadContextProvider::SetupLock() {
146 context_->SetLock(&context_lock_); 153 context_->SetLock(&context_lock_);
147 } 154 }
148 155
149 base::Lock* AwRenderThreadContextProvider::GetLock() { 156 base::Lock* AwRenderThreadContextProvider::GetLock() {
150 return &context_lock_; 157 return &context_lock_;
151 } 158 }
152 159
153 bool AwRenderThreadContextProvider::IsContextLost() { 160 bool AwRenderThreadContextProvider::IsContextLost() {
154 DCHECK(main_thread_checker_.CalledOnValidThread()); 161 DCHECK(main_thread_checker_.CalledOnValidThread());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return; 199 return;
193 destroyed_ = true; 200 destroyed_ = true;
194 201
195 if (!lost_context_callback_.is_null()) 202 if (!lost_context_callback_.is_null())
196 base::ResetAndReturn(&lost_context_callback_).Run(); 203 base::ResetAndReturn(&lost_context_callback_).Run();
197 if (gr_context_) 204 if (gr_context_)
198 gr_context_->abandonContext(); 205 gr_context_->abandonContext();
199 } 206 }
200 207
201 } // namespace android_webview 208 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698