| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 cc::CompositorFrame frame) { | 1094 cc::CompositorFrame frame) { |
| 1095 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1095 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
| 1096 DCHECK(delegated_frame_host_); | 1096 DCHECK(delegated_frame_host_); |
| 1097 | 1097 |
| 1098 if (locks_on_frame_count_ > 0) { | 1098 if (locks_on_frame_count_ > 0) { |
| 1099 DCHECK(HasValidFrame()); | 1099 DCHECK(HasValidFrame()); |
| 1100 RetainFrame(compositor_frame_sink_id, std::move(frame)); | 1100 RetainFrame(compositor_frame_sink_id, std::move(frame)); |
| 1101 return; | 1101 return; |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SwapCompositorFrame"); |
| 1105 |
| 1104 DCHECK(!frame.render_pass_list.empty()); | 1106 DCHECK(!frame.render_pass_list.empty()); |
| 1105 | 1107 |
| 1106 cc::RenderPass* root_pass = frame.render_pass_list.back().get(); | 1108 cc::RenderPass* root_pass = frame.render_pass_list.back().get(); |
| 1107 current_surface_size_ = root_pass->output_rect.size(); | 1109 current_surface_size_ = root_pass->output_rect.size(); |
| 1108 bool is_transparent = root_pass->has_transparent_background; | 1110 bool is_transparent = root_pass->has_transparent_background; |
| 1109 | 1111 |
| 1110 cc::CompositorFrameMetadata metadata = frame.metadata.Clone(); | 1112 cc::CompositorFrameMetadata metadata = frame.metadata.Clone(); |
| 1111 | 1113 |
| 1112 CheckCompositorFrameSinkChanged(compositor_frame_sink_id); | 1114 CheckCompositorFrameSinkChanged(compositor_frame_sink_id); |
| 1113 bool has_content = !current_surface_size_.IsEmpty(); | 1115 bool has_content = !current_surface_size_.IsEmpty(); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 args.deadline = sync_compositor_ ? base::TimeTicks() | 1532 args.deadline = sync_compositor_ ? base::TimeTicks() |
| 1531 : args.frame_time + (args.interval * 0.6); | 1533 : args.frame_time + (args.interval * 0.6); |
| 1532 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); | 1534 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); |
| 1533 if (sync_compositor_) | 1535 if (sync_compositor_) |
| 1534 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); | 1536 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); |
| 1535 } | 1537 } |
| 1536 | 1538 |
| 1537 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1539 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
| 1538 bool needs_animate = false; | 1540 bool needs_animate = false; |
| 1539 if (overscroll_controller_ && !is_in_vr_) { | 1541 if (overscroll_controller_ && !is_in_vr_) { |
| 1542 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::Animate", "frame_time", |
| 1543 frame_time); |
| 1540 needs_animate |= overscroll_controller_->Animate( | 1544 needs_animate |= overscroll_controller_->Animate( |
| 1541 frame_time, content_view_core_->GetViewAndroid()->GetLayer()); | 1545 frame_time, content_view_core_->GetViewAndroid()->GetLayer()); |
| 1542 } | 1546 } |
| 1543 if (selection_controller_) | 1547 if (selection_controller_) |
| 1544 needs_animate |= selection_controller_->Animate(frame_time); | 1548 needs_animate |= selection_controller_->Animate(frame_time); |
| 1545 return needs_animate; | 1549 return needs_animate; |
| 1546 } | 1550 } |
| 1547 | 1551 |
| 1548 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { | 1552 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { |
| 1549 if (content_view_core_) | 1553 if (content_view_core_) |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2071 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2068 if (!compositor) | 2072 if (!compositor) |
| 2069 return; | 2073 return; |
| 2070 | 2074 |
| 2071 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2075 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2072 overscroll_refresh_handler, compositor, | 2076 overscroll_refresh_handler, compositor, |
| 2073 ui::GetScaleFactorForNativeView(GetNativeView())); | 2077 ui::GetScaleFactorForNativeView(GetNativeView())); |
| 2074 } | 2078 } |
| 2075 | 2079 |
| 2076 } // namespace content | 2080 } // namespace content |
| OLD | NEW |