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

Side by Side Diff: android_webview/browser/scoped_app_gl_state_restore.cc

Issue 2375743002: [Merge M54] aw: Fix FBO restore in webview functor (Closed)
Patch Set: Created 4 years, 2 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 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 "android_webview/browser/scoped_app_gl_state_restore.h" 5 #include "android_webview/browser/scoped_app_gl_state_restore.h"
6 6
7 #include <string> 7 #include <string>
8 8
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DLOG_IF(WARNING, warn) << error << " " << msg; 59 DLOG_IF(WARNING, warn) << error << " " << msg;
60 no_error = false; 60 no_error = false;
61 } 61 }
62 62
63 return no_error; 63 return no_error;
64 } 64 }
65 65
66 bool g_globals_initialized = false; 66 bool g_globals_initialized = false;
67 GLint g_gl_max_texture_units = 0; 67 GLint g_gl_max_texture_units = 0;
68 bool g_supports_oes_vertex_array_object = false; 68 bool g_supports_oes_vertex_array_object = false;
69 ScopedAppGLStateRestore* g_current_instance = nullptr;
69 70
70 } // namespace 71 } // namespace
71 72
72 namespace internal { 73 namespace internal {
73 74
74 class ScopedAppGLStateRestoreImpl { 75 class ScopedAppGLStateRestoreImpl {
75 public: 76 public:
76 explicit ScopedAppGLStateRestoreImpl(ScopedAppGLStateRestore::CallMode mode); 77 explicit ScopedAppGLStateRestoreImpl(ScopedAppGLStateRestore::CallMode mode);
77 ~ScopedAppGLStateRestoreImpl(); 78 ~ScopedAppGLStateRestoreImpl();
78 79
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 glStencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op, 410 glStencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op,
410 stencil_state_.stencil_back_z_fail_op, 411 stencil_state_.stencil_back_z_fail_op,
411 stencil_state_.stencil_back_z_pass_op); 412 stencil_state_.stencil_back_z_pass_op);
412 413
413 // Do not leak GLError out of chromium. 414 // Do not leak GLError out of chromium.
414 ClearGLErrors(true, "Chromium GLError"); 415 ClearGLErrors(true, "Chromium GLError");
415 } 416 }
416 417
417 } // namespace internal 418 } // namespace internal
418 419
420 // static
421 ScopedAppGLStateRestore* ScopedAppGLStateRestore::Current() {
422 DCHECK(g_current_instance);
423 return g_current_instance;
424 }
425
419 ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode) 426 ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode)
420 : impl_(new internal::ScopedAppGLStateRestoreImpl(mode)) { 427 : impl_(new internal::ScopedAppGLStateRestoreImpl(mode)) {
428 DCHECK(!g_current_instance);
429 g_current_instance = this;
421 } 430 }
422 431
423 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {} 432 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {
433 DCHECK_EQ(this, g_current_instance);
434 g_current_instance = nullptr;
435 }
424 436
425 StencilState ScopedAppGLStateRestore::stencil_state() const { 437 StencilState ScopedAppGLStateRestore::stencil_state() const {
426 return impl_->stencil_state(); 438 return impl_->stencil_state();
427 } 439 }
428 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { 440 int ScopedAppGLStateRestore::framebuffer_binding_ext() const {
429 return impl_->framebuffer_binding_ext(); 441 return impl_->framebuffer_binding_ext();
430 } 442 }
431 443
432 } // namespace android_webview 444 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/scoped_app_gl_state_restore.h ('k') | android_webview/browser/surfaces_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698