| 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/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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { | 252 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { |
| 253 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDrawHardware"); | 253 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDrawHardware"); |
| 254 if (!compositor_) | 254 if (!compositor_) |
| 255 return false; | 255 return false; |
| 256 | 256 |
| 257 if (last_on_draw_global_visible_rect_.IsEmpty()) { | 257 if (last_on_draw_global_visible_rect_.IsEmpty()) { |
| 258 TRACE_EVENT_INSTANT0("android_webview", | 258 TRACE_EVENT_INSTANT0("android_webview", |
| 259 "EarlyOut_EmptyVisibleRect", | 259 "EarlyOut_EmptyVisibleRect", |
| 260 TRACE_EVENT_SCOPE_THREAD); | 260 TRACE_EVENT_SCOPE_THREAD); |
| 261 shared_renderer_state_->SetForceInvalidateOnNextDrawGL(true); |
| 261 return client_->RequestDrawGL(java_canvas, false); | 262 return client_->RequestDrawGL(java_canvas, false); |
| 262 } | 263 } |
| 263 | 264 |
| 264 if (!hardware_enabled_) { | 265 if (!hardware_enabled_) { |
| 265 hardware_enabled_ = compositor_->InitializeHwDraw(); | 266 hardware_enabled_ = compositor_->InitializeHwDraw(); |
| 266 if (hardware_enabled_) { | 267 if (hardware_enabled_) { |
| 267 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); | 268 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); |
| 268 } | 269 } |
| 269 } | 270 } |
| 270 if (!hardware_enabled_) | 271 if (!hardware_enabled_) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 320 |
| 320 frame->AssignTo(&draw_gl_input->frame); | 321 frame->AssignTo(&draw_gl_input->frame); |
| 321 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); | 322 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); |
| 322 DidComposite(); | 323 DidComposite(); |
| 323 return client_->RequestDrawGL(java_canvas, false); | 324 return client_->RequestDrawGL(java_canvas, false); |
| 324 } | 325 } |
| 325 | 326 |
| 326 void BrowserViewRenderer::UpdateParentDrawConstraints() { | 327 void BrowserViewRenderer::UpdateParentDrawConstraints() { |
| 327 // Post an invalidate if the parent draw constraints are stale and there is | 328 // Post an invalidate if the parent draw constraints are stale and there is |
| 328 // no pending invalidate. | 329 // no pending invalidate. |
| 329 if (!parent_draw_constraints_.Equals( | 330 if (shared_renderer_state_->NeedsForceInvalidateOnNextDrawGL() || |
| 330 shared_renderer_state_->ParentDrawConstraints())) | 331 !parent_draw_constraints_.Equals( |
| 332 shared_renderer_state_->ParentDrawConstraints())) { |
| 333 shared_renderer_state_->SetForceInvalidateOnNextDrawGL(false); |
| 331 EnsureContinuousInvalidation(true); | 334 EnsureContinuousInvalidation(true); |
| 335 } |
| 332 } | 336 } |
| 333 | 337 |
| 334 void BrowserViewRenderer::ReturnUnusedResource(scoped_ptr<DrawGLInput> input) { | 338 void BrowserViewRenderer::ReturnUnusedResource(scoped_ptr<DrawGLInput> input) { |
| 335 if (!input.get()) | 339 if (!input.get()) |
| 336 return; | 340 return; |
| 337 | 341 |
| 338 cc::CompositorFrameAck frame_ack; | 342 cc::CompositorFrameAck frame_ack; |
| 339 cc::TransferableResource::ReturnResources( | 343 cc::TransferableResource::ReturnResources( |
| 340 input->frame.delegated_frame_data->resource_list, | 344 input->frame.delegated_frame_data->resource_list, |
| 341 &frame_ack.resources); | 345 &frame_ack.resources); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 base::StringAppendF(&str, | 820 base::StringAppendF(&str, |
| 817 "surface width height: [%d %d] ", | 821 "surface width height: [%d %d] ", |
| 818 draw_info->width, | 822 draw_info->width, |
| 819 draw_info->height); | 823 draw_info->height); |
| 820 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 824 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 821 } | 825 } |
| 822 return str; | 826 return str; |
| 823 } | 827 } |
| 824 | 828 |
| 825 } // namespace android_webview | 829 } // namespace android_webview |
| OLD | NEW |