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

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

Issue 25082006: [Android WebView] OnMemoryPressure to drop tile memory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unregister Created 7 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 | Annotate | Revision Log
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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_surface_stub.h" 10 #include "ui/gl/gl_surface_stub.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vertex_array_buffer_binding_); 59 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vertex_array_buffer_binding_);
60 glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &index_array_buffer_binding_); 60 glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &index_array_buffer_binding_);
61 61
62 switch(mode_) { 62 switch(mode_) {
63 case MODE_DRAW: 63 case MODE_DRAW:
64 DCHECK_EQ(0, vertex_array_buffer_binding_); 64 DCHECK_EQ(0, vertex_array_buffer_binding_);
65 DCHECK_EQ(0, index_array_buffer_binding_); 65 DCHECK_EQ(0, index_array_buffer_binding_);
66 break; 66 break;
67 case MODE_DETACH_FROM_WINDOW: 67 case MODE_DETACH_FROM_WINDOW:
68 case MODE_ON_TRIM:
68 glGetBooleanv(GL_BLEND, &blend_enabled_); 69 glGetBooleanv(GL_BLEND, &blend_enabled_);
69 glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb_); 70 glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb_);
70 glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha_); 71 glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha_);
71 glGetIntegerv(GL_BLEND_DST_RGB, &blend_dest_rgb_); 72 glGetIntegerv(GL_BLEND_DST_RGB, &blend_dest_rgb_);
72 glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dest_alpha_); 73 glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dest_alpha_);
73 glGetIntegerv(GL_VIEWPORT, viewport_); 74 glGetIntegerv(GL_VIEWPORT, viewport_);
74 glGetBooleanv(GL_SCISSOR_TEST, &scissor_test_); 75 glGetBooleanv(GL_SCISSOR_TEST, &scissor_test_);
75 glGetIntegerv(GL_SCISSOR_BOX, scissor_box_); 76 glGetIntegerv(GL_SCISSOR_BOX, scissor_box_);
76 break; 77 break;
77 } 78 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 glLineWidth(line_width_); 199 glLineWidth(line_width_);
199 glPolygonOffset(polygon_offset_factor_, polygon_offset_units_); 200 glPolygonOffset(polygon_offset_factor_, polygon_offset_units_);
200 glSampleCoverage(sample_coverage_value_, sample_coverage_invert_); 201 glSampleCoverage(sample_coverage_value_, sample_coverage_invert_);
201 202
202 GLEnableDisable(GL_DITHER, enable_dither_); 203 GLEnableDisable(GL_DITHER, enable_dither_);
203 GLEnableDisable(GL_POLYGON_OFFSET_FILL, enable_polygon_offset_fill_); 204 GLEnableDisable(GL_POLYGON_OFFSET_FILL, enable_polygon_offset_fill_);
204 GLEnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE, 205 GLEnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE,
205 enable_sample_alpha_to_coverage_); 206 enable_sample_alpha_to_coverage_);
206 GLEnableDisable(GL_SAMPLE_COVERAGE, enable_sample_coverage_); 207 GLEnableDisable(GL_SAMPLE_COVERAGE, enable_sample_coverage_);
207 208
208 if (mode_ == MODE_DETACH_FROM_WINDOW) { 209 switch(mode_) {
209 GLEnableDisable(GL_BLEND, blend_enabled_); 210 case MODE_DRAW:
210 glBlendFuncSeparate( 211 // No-op.
211 blend_src_rgb_, blend_dest_rgb_, blend_src_alpha_, blend_dest_alpha_); 212 break;
213 case MODE_DETACH_FROM_WINDOW:
214 case MODE_ON_TRIM:
215 GLEnableDisable(GL_BLEND, blend_enabled_);
216 glBlendFuncSeparate(
217 blend_src_rgb_, blend_dest_rgb_, blend_src_alpha_, blend_dest_alpha_);
212 218
213 glViewport(viewport_[0], viewport_[1], viewport_[2], viewport_[3]); 219 glViewport(viewport_[0], viewport_[1], viewport_[2], viewport_[3]);
214 220
215 GLEnableDisable(GL_SCISSOR_TEST, scissor_test_); 221 GLEnableDisable(GL_SCISSOR_TEST, scissor_test_);
216 222
217 glScissor( 223 glScissor(
218 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]); 224 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]);
225 break;
219 } 226 }
220 227
221 GLEnableDisable(GL_STENCIL_TEST, stencil_test_); 228 GLEnableDisable(GL_STENCIL_TEST, stencil_test_);
222 glStencilFunc(stencil_func_, stencil_mask_, stencil_ref_); 229 glStencilFunc(stencil_func_, stencil_mask_, stencil_ref_);
223 } 230 }
224 231
225 } // namespace android_webview 232 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698