| OLD | NEW |
| 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/parent_compositor_draw_constraints.h" |
| 8 #include "android_webview/browser/shared_renderer_state.h" | 9 #include "android_webview/browser/shared_renderer_state.h" |
| 9 #include "android_webview/common/aw_switches.h" | 10 #include "android_webview/common/aw_switches.h" |
| 10 #include "android_webview/public/browser/draw_gl.h" | 11 #include "android_webview/public/browser/draw_gl.h" |
| 11 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 12 #include "base/auto_reset.h" | 13 #include "base/auto_reset.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 15 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ReturnResourceFromParent(); | 252 ReturnResourceFromParent(); |
| 252 SynchronousCompositorMemoryPolicy new_policy = CalculateDesiredMemoryPolicy(); | 253 SynchronousCompositorMemoryPolicy new_policy = CalculateDesiredMemoryPolicy(); |
| 253 RequestMemoryPolicy(new_policy); | 254 RequestMemoryPolicy(new_policy); |
| 254 compositor_->SetMemoryPolicy(memory_policy_); | 255 compositor_->SetMemoryPolicy(memory_policy_); |
| 255 | 256 |
| 256 scoped_ptr<DrawGLInput> draw_gl_input(new DrawGLInput); | 257 scoped_ptr<DrawGLInput> draw_gl_input(new DrawGLInput); |
| 257 draw_gl_input->scroll_offset = last_on_draw_scroll_offset_; | 258 draw_gl_input->scroll_offset = last_on_draw_scroll_offset_; |
| 258 draw_gl_input->width = width_; | 259 draw_gl_input->width = width_; |
| 259 draw_gl_input->height = height_; | 260 draw_gl_input->height = height_; |
| 260 | 261 |
| 261 gfx::Transform transform; | |
| 262 gfx::Size surface_size(width_, height_); | 262 gfx::Size surface_size(width_, height_); |
| 263 gfx::Rect viewport(surface_size); | 263 gfx::Rect viewport(surface_size); |
| 264 // TODO(boliu): Should really be |last_on_draw_global_visible_rect_|. | |
| 265 // See crbug.com/372073. | |
| 266 gfx::Rect clip = viewport; | 264 gfx::Rect clip = viewport; |
| 267 scoped_ptr<cc::CompositorFrame> frame = compositor_->DemandDrawHw( | 265 gfx::Rect external_tiling_rect; |
| 268 surface_size, transform, viewport, clip); | 266 gfx::Transform external_tiling_transform = parent_draw_constraints_.transform; |
| 267 ; |
| 268 |
| 269 parent_draw_constraints_ = shared_renderer_state_->ParentDrawConstraints(); |
| 270 |
| 271 // If the WebView is on a layer, the parent transform is just an identity |
| 272 // matrix and WebView does not know what transform is applied onto the layer. |
| 273 // In this case, just use the surface rect for tiling. |
| 274 if (parent_draw_constraints_.is_layer) |
| 275 external_tiling_rect = parent_draw_constraints_.surface_rect; |
| 276 else |
| 277 external_tiling_rect = last_on_draw_global_visible_rect_; |
| 278 |
| 279 scoped_ptr<cc::CompositorFrame> frame = |
| 280 compositor_->DemandDrawHw(surface_size, |
| 281 gfx::Transform(), |
| 282 viewport, |
| 283 clip, |
| 284 external_tiling_rect, |
| 285 external_tiling_transform); |
| 269 if (!frame.get()) | 286 if (!frame.get()) |
| 270 return false; | 287 return false; |
| 271 | 288 |
| 272 GlobalTileManager::GetInstance()->DidUse(tile_manager_key_); | 289 GlobalTileManager::GetInstance()->DidUse(tile_manager_key_); |
| 273 | 290 |
| 274 frame->AssignTo(&draw_gl_input->frame); | 291 frame->AssignTo(&draw_gl_input->frame); |
| 275 ReturnUnusedResource(shared_renderer_state_->PassDrawGLInput()); | 292 ReturnUnusedResource(shared_renderer_state_->PassDrawGLInput()); |
| 276 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); | 293 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); |
| 277 DidComposite(); | 294 DidComposite(); |
| 278 return client_->RequestDrawGL(java_canvas, false); | 295 return client_->RequestDrawGL(java_canvas, false); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 base::StringAppendF(&str, | 768 base::StringAppendF(&str, |
| 752 "surface width height: [%d %d] ", | 769 "surface width height: [%d %d] ", |
| 753 draw_info->width, | 770 draw_info->width, |
| 754 draw_info->height); | 771 draw_info->height); |
| 755 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 772 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 756 } | 773 } |
| 757 return str; | 774 return str; |
| 758 } | 775 } |
| 759 | 776 |
| 760 } // namespace android_webview | 777 } // namespace android_webview |
| OLD | NEW |