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/browser_view_renderer.cc

Issue 599633004: Android WebView: fix missing an invalidate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 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
« no previous file with comments | « no previous file | android_webview/browser/hardware_renderer.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser_view_renderer.h" 5 #include "android_webview/browser/browser_view_renderer.h"
6 6
7 #include "android_webview/browser/browser_view_renderer_client.h" 7 #include "android_webview/browser/browser_view_renderer_client.h"
8 #include "android_webview/browser/shared_renderer_state.h" 8 #include "android_webview/browser/shared_renderer_state.h"
9 #include "android_webview/common/aw_switches.h" 9 #include "android_webview/common/aw_switches.h"
10 #include "android_webview/public/browser/draw_gl.h" 10 #include "android_webview/public/browser/draw_gl.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 // Perform a software draw 239 // Perform a software draw
240 return OnDrawSoftware(java_canvas); 240 return OnDrawSoftware(java_canvas);
241 } 241 }
242 242
243 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { 243 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) {
244 if (!compositor_) 244 if (!compositor_)
245 return false; 245 return false;
246 246
247 if (last_on_draw_global_visible_rect_.IsEmpty()) 247 if (last_on_draw_global_visible_rect_.IsEmpty()) {
248 shared_renderer_state_->SetForceInvalidateOnNextDrawGL(true);
248 return client_->RequestDrawGL(java_canvas, false); 249 return client_->RequestDrawGL(java_canvas, false);
250 }
249 251
250 if (!hardware_enabled_) { 252 if (!hardware_enabled_) {
251 hardware_enabled_ = compositor_->InitializeHwDraw(); 253 hardware_enabled_ = compositor_->InitializeHwDraw();
252 if (hardware_enabled_) { 254 if (hardware_enabled_) {
253 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); 255 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this);
254 gpu::GLInProcessContext* share_context = compositor_->GetShareContext(); 256 gpu::GLInProcessContext* share_context = compositor_->GetShareContext();
255 DCHECK(share_context); 257 DCHECK(share_context);
256 shared_renderer_state_->SetSharedContext(share_context); 258 shared_renderer_state_->SetSharedContext(share_context);
257 } 259 }
258 } 260 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 frame->AssignTo(&draw_gl_input->frame); 302 frame->AssignTo(&draw_gl_input->frame);
301 ReturnUnusedResource(shared_renderer_state_->PassDrawGLInput()); 303 ReturnUnusedResource(shared_renderer_state_->PassDrawGLInput());
302 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); 304 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass());
303 DidComposite(); 305 DidComposite();
304 return client_->RequestDrawGL(java_canvas, false); 306 return client_->RequestDrawGL(java_canvas, false);
305 } 307 }
306 308
307 void BrowserViewRenderer::UpdateParentDrawConstraints() { 309 void BrowserViewRenderer::UpdateParentDrawConstraints() {
308 // Post an invalidate if the parent draw constraints are stale and there is 310 // Post an invalidate if the parent draw constraints are stale and there is
309 // no pending invalidate. 311 // no pending invalidate.
310 if (!parent_draw_constraints_.Equals( 312 if (shared_renderer_state_->NeedsForceInvalidateOnNextDrawGL() ||
311 shared_renderer_state_->ParentDrawConstraints())) 313 !parent_draw_constraints_.Equals(
314 shared_renderer_state_->ParentDrawConstraints())) {
315 shared_renderer_state_->SetForceInvalidateOnNextDrawGL(false);
312 EnsureContinuousInvalidation(true); 316 EnsureContinuousInvalidation(true);
317 }
313 } 318 }
314 319
315 void BrowserViewRenderer::ReturnUnusedResource(scoped_ptr<DrawGLInput> input) { 320 void BrowserViewRenderer::ReturnUnusedResource(scoped_ptr<DrawGLInput> input) {
316 if (!input.get()) 321 if (!input.get())
317 return; 322 return;
318 323
319 cc::CompositorFrameAck frame_ack; 324 cc::CompositorFrameAck frame_ack;
320 cc::TransferableResource::ReturnResources( 325 cc::TransferableResource::ReturnResources(
321 input->frame.delegated_frame_data->resource_list, 326 input->frame.delegated_frame_data->resource_list,
322 &frame_ack.resources); 327 &frame_ack.resources);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 base::StringAppendF(&str, 803 base::StringAppendF(&str,
799 "surface width height: [%d %d] ", 804 "surface width height: [%d %d] ",
800 draw_info->width, 805 draw_info->width,
801 draw_info->height); 806 draw_info->height);
802 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); 807 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer);
803 } 808 }
804 return str; 809 return str;
805 } 810 }
806 811
807 } // namespace android_webview 812 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/hardware_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698