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

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

Issue 1002013003: Unit Test for WebView animating in and out of screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes to test Created 5 years, 9 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 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/hardware_renderer.h" 5 #include "android_webview/browser/hardware_renderer.h"
6 6
7 #include "android_webview/browser/aw_gl_surface.h" 7 #include "android_webview/browser/aw_gl_surface.h"
8 #include "android_webview/browser/child_frame.h" 8 #include "android_webview/browser/child_frame.h"
9 #include "android_webview/browser/deferred_gpu_command_service.h" 9 #include "android_webview/browser/deferred_gpu_command_service.h"
10 #include "android_webview/browser/parent_compositor_draw_constraints.h" 10 #include "android_webview/browser/parent_compositor_draw_constraints.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DCHECK(current_context) << "DrawGL called without EGLContext"; 198 DCHECK(current_context) << "DrawGL called without EGLContext";
199 199
200 // TODO(boliu): Handle context loss. 200 // TODO(boliu): Handle context loss.
201 if (last_egl_context_ != current_context) 201 if (last_egl_context_ != current_context)
202 DLOG(WARNING) << "EGLContextChanged"; 202 DLOG(WARNING) << "EGLContextChanged";
203 203
204 gfx::Transform transform(gfx::Transform::kSkipInitialization); 204 gfx::Transform transform(gfx::Transform::kSkipInitialization);
205 transform.matrix().setColMajorf(draw_info->transform); 205 transform.matrix().setColMajorf(draw_info->transform);
206 transform.Translate(scroll_offset_.x(), scroll_offset_.y()); 206 transform.Translate(scroll_offset_.x(), scroll_offset_.y());
207 207
208 viewport_.SetSize(draw_info->width, draw_info->height);
208 // Need to post the new transform matrix back to child compositor 209 // Need to post the new transform matrix back to child compositor
209 // because there is no onDraw during a Render Thread animation, and child 210 // because there is no onDraw during a Render Thread animation, and child
210 // compositor might not have the tiles rasterized as the animation goes on. 211 // compositor might not have the tiles rasterized as the animation goes on.
211 ParentCompositorDrawConstraints draw_constraints( 212 ParentCompositorDrawConstraints draw_constraints(
212 draw_info->is_layer, transform, gfx::Rect(viewport_)); 213 draw_info->is_layer, transform, gfx::Rect(viewport_));
213 if (!child_frame_.get() || draw_constraints.NeedUpdate(*child_frame_)) { 214 if (!child_frame_.get() || draw_constraints.NeedUpdate(*child_frame_)) {
214 shared_renderer_state_->PostExternalDrawConstraintsToChildCompositorOnRT( 215 shared_renderer_state_->PostExternalDrawConstraintsToChildCompositorOnRT(
215 draw_constraints); 216 draw_constraints);
216 } 217 }
217 218
218 if (!delegated_layer_.get()) 219 if (!delegated_layer_.get())
219 return; 220 return;
220 221
221 viewport_.SetSize(draw_info->width, draw_info->height);
222 layer_tree_host_->SetViewportSize(viewport_); 222 layer_tree_host_->SetViewportSize(viewport_);
223 clip_.SetRect(draw_info->clip_left, 223 clip_.SetRect(draw_info->clip_left,
224 draw_info->clip_top, 224 draw_info->clip_top,
225 draw_info->clip_right - draw_info->clip_left, 225 draw_info->clip_right - draw_info->clip_left,
226 draw_info->clip_bottom - draw_info->clip_top); 226 draw_info->clip_bottom - draw_info->clip_top);
227 stencil_enabled_ = stencil_enabled; 227 stencil_enabled_ = stencil_enabled;
228 228
229 delegated_layer_->SetTransform(transform); 229 delegated_layer_->SetTransform(transform);
230 230
231 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); 231 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext);
(...skipping 21 matching lines...) Expand all
253 } 253 }
254 254
255 void HardwareRenderer::UnusedResourcesAreAvailable() { 255 void HardwareRenderer::UnusedResourcesAreAvailable() {
256 cc::ReturnedResourceArray returned_resources; 256 cc::ReturnedResourceArray returned_resources;
257 resource_collection_->TakeUnusedResourcesForChildCompositor( 257 resource_collection_->TakeUnusedResourcesForChildCompositor(
258 &returned_resources); 258 &returned_resources);
259 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources); 259 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources);
260 } 260 }
261 261
262 } // namespace android_webview 262 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698