| 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 "base/auto_reset.h" | 8 #include "base/auto_reset.h" | 
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 209   if (!hardware_enabled_) { | 209   if (!hardware_enabled_) { | 
| 210     TRACE_EVENT0("android_webview", "InitializeHwDraw"); | 210     TRACE_EVENT0("android_webview", "InitializeHwDraw"); | 
| 211     hardware_enabled_ = compositor_->InitializeHwDraw(); | 211     hardware_enabled_ = compositor_->InitializeHwDraw(); | 
| 212   } | 212   } | 
| 213   if (!hardware_enabled_) { | 213   if (!hardware_enabled_) { | 
| 214     TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_HardwareNotEnabled", | 214     TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_HardwareNotEnabled", | 
| 215                          TRACE_EVENT_SCOPE_THREAD); | 215                          TRACE_EVENT_SCOPE_THREAD); | 
| 216     return false; | 216     return false; | 
| 217   } | 217   } | 
| 218 | 218 | 
|  | 219   if (last_on_draw_global_visible_rect_.IsEmpty()) { | 
|  | 220     // WebView could be offscreen. Need to make sure WebView invalidates when | 
|  | 221     // it is animated into the screen again. | 
|  | 222     shared_renderer_state_.SetForceInvalidateOnNextDrawGLOnUI(true); | 
|  | 223   } | 
|  | 224 | 
| 219   ReturnResourceFromParent(); | 225   ReturnResourceFromParent(); | 
| 220   if (shared_renderer_state_.HasCompositorFrameOnUI()) { | 226   if (shared_renderer_state_.HasCompositorFrameOnUI()) { | 
| 221     TRACE_EVENT_INSTANT0("android_webview", | 227     TRACE_EVENT_INSTANT0("android_webview", | 
| 222                          "EarlyOut_PreviousFrameUnconsumed", | 228                          "EarlyOut_PreviousFrameUnconsumed", | 
| 223                          TRACE_EVENT_SCOPE_THREAD); | 229                          TRACE_EVENT_SCOPE_THREAD); | 
| 224     DidSkipCompositeInDraw(); | 230     DidSkipCompositeInDraw(); | 
| 225     return true; | 231     return true; | 
| 226   } | 232   } | 
| 227 | 233 | 
| 228   scoped_ptr<cc::CompositorFrame> frame = CompositeHw(); | 234   scoped_ptr<cc::CompositorFrame> frame = CompositeHw(); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 255   // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. | 261   // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. | 
| 256   if (!offscreen_pre_raster_) { | 262   if (!offscreen_pre_raster_) { | 
| 257     if (parent_draw_constraints_.is_layer || | 263     if (parent_draw_constraints_.is_layer || | 
| 258         last_on_draw_global_visible_rect_.IsEmpty()) { | 264         last_on_draw_global_visible_rect_.IsEmpty()) { | 
| 259       viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect; | 265       viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect; | 
| 260     } else { | 266     } else { | 
| 261       viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; | 267       viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; | 
| 262     } | 268     } | 
| 263   } | 269   } | 
| 264 | 270 | 
| 265   scoped_ptr<cc::CompositorFrame> frame = | 271   scoped_ptr<cc::CompositorFrame> frame = compositor_->DemandDrawHw( | 
| 266       compositor_->DemandDrawHw(surface_size, | 272       surface_size, gfx::Transform(), viewport, clip, | 
| 267                                 gfx::Transform(), | 273       viewport_rect_for_tile_priority, transform_for_tile_priority); | 
| 268                                 viewport, |  | 
| 269                                 clip, |  | 
| 270                                 viewport_rect_for_tile_priority, |  | 
| 271                                 transform_for_tile_priority); |  | 
| 272   if (frame.get()) | 274   if (frame.get()) | 
| 273     DidComposite(); | 275     DidComposite(); | 
| 274   return frame.Pass(); | 276   return frame.Pass(); | 
| 275 } | 277 } | 
| 276 | 278 | 
| 277 void BrowserViewRenderer::UpdateParentDrawConstraints() { | 279 void BrowserViewRenderer::UpdateParentDrawConstraints() { | 
| 278   // Post an invalidate if the parent draw constraints are stale and there is | 280   // Post an invalidate if the parent draw constraints are stale and there is | 
| 279   // no pending invalidate. | 281   // no pending invalidate. | 
| 280   bool needs_force_invalidate = | 282   bool needs_force_invalidate = | 
| 281       shared_renderer_state_.NeedsForceInvalidateOnNextDrawGLOnUI(); | 283       shared_renderer_state_.NeedsForceInvalidateOnNextDrawGLOnUI(); | 
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 784   base::StringAppendF(&str, | 786   base::StringAppendF(&str, | 
| 785                       "overscroll_rounding_error_: %s ", | 787                       "overscroll_rounding_error_: %s ", | 
| 786                       overscroll_rounding_error_.ToString().c_str()); | 788                       overscroll_rounding_error_.ToString().c_str()); | 
| 787   base::StringAppendF( | 789   base::StringAppendF( | 
| 788       &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 790       &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 
| 789   base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 791   base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 
| 790   return str; | 792   return str; | 
| 791 } | 793 } | 
| 792 | 794 | 
| 793 }  // namespace android_webview | 795 }  // namespace android_webview | 
| OLD | NEW | 
|---|