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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 return; | 539 return; |
540 } | 540 } |
541 | 541 |
542 DCHECK_GT(locks_on_frame_count_, 0u); | 542 DCHECK_GT(locks_on_frame_count_, 0u); |
543 locks_on_frame_count_--; | 543 locks_on_frame_count_--; |
544 frame_evictor_->UnlockFrame(); | 544 frame_evictor_->UnlockFrame(); |
545 | 545 |
546 if (locks_on_frame_count_ == 0) { | 546 if (locks_on_frame_count_ == 0) { |
547 if (last_frame_info_) { | 547 if (last_frame_info_) { |
548 InternalSwapCompositorFrame(last_frame_info_->output_surface_id, | 548 InternalSwapCompositorFrame(last_frame_info_->output_surface_id, |
| 549 cc::SurfaceId(), |
549 std::move(last_frame_info_->frame)); | 550 std::move(last_frame_info_->frame)); |
550 last_frame_info_.reset(); | 551 last_frame_info_.reset(); |
551 } | 552 } |
552 | 553 |
553 if (!is_showing_ && view_.GetLayer()) | 554 if (!is_showing_ && view_.GetLayer()) |
554 view_.GetLayer()->SetHideLayerAndSubtree(true); | 555 view_.GetLayer()->SetHideLayerAndSubtree(true); |
555 } | 556 } |
556 } | 557 } |
557 | 558 |
558 void RenderWidgetHostViewAndroid::SetTextSurroundingSelectionCallback( | 559 void RenderWidgetHostViewAndroid::SetTextSurroundingSelectionCallback( |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1015 |
1015 cc::SurfaceFactory::DrawCallback ack_callback = | 1016 cc::SurfaceFactory::DrawCallback ack_callback = |
1016 base::Bind(&RenderWidgetHostViewAndroid::RunAckCallbacks, | 1017 base::Bind(&RenderWidgetHostViewAndroid::RunAckCallbacks, |
1017 weak_ptr_factory_.GetWeakPtr()); | 1018 weak_ptr_factory_.GetWeakPtr()); |
1018 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), | 1019 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
1019 ack_callback); | 1020 ack_callback); |
1020 } | 1021 } |
1021 | 1022 |
1022 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( | 1023 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
1023 uint32_t output_surface_id, | 1024 uint32_t output_surface_id, |
| 1025 const cc::SurfaceId& surface_id, |
1024 cc::CompositorFrame frame) { | 1026 cc::CompositorFrame frame) { |
1025 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1027 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
1026 DCHECK(frame.delegated_frame_data); | 1028 DCHECK(frame.delegated_frame_data); |
1027 DCHECK(CompositorImpl::GetSurfaceManager()); | 1029 DCHECK(CompositorImpl::GetSurfaceManager()); |
1028 | 1030 |
1029 if (locks_on_frame_count_ > 0) { | 1031 if (locks_on_frame_count_ > 0) { |
1030 DCHECK(HasValidFrame()); | 1032 DCHECK(HasValidFrame()); |
1031 RetainFrame(output_surface_id, std::move(frame)); | 1033 RetainFrame(output_surface_id, std::move(frame)); |
1032 return; | 1034 return; |
1033 } | 1035 } |
(...skipping 29 matching lines...) Expand all Loading... |
1063 RunAckCallbacks(cc::SurfaceDrawStatus::DRAW_SKIPPED); | 1065 RunAckCallbacks(cc::SurfaceDrawStatus::DRAW_SKIPPED); |
1064 frame_evictor_->SwappedFrame(!host_->is_hidden()); | 1066 frame_evictor_->SwappedFrame(!host_->is_hidden()); |
1065 | 1067 |
1066 // As the metadata update may trigger view invalidation, always call it after | 1068 // As the metadata update may trigger view invalidation, always call it after |
1067 // any potential compositor scheduling. | 1069 // any potential compositor scheduling. |
1068 OnFrameMetadataUpdated(std::move(metadata)); | 1070 OnFrameMetadataUpdated(std::move(metadata)); |
1069 } | 1071 } |
1070 | 1072 |
1071 void RenderWidgetHostViewAndroid::OnSwapCompositorFrame( | 1073 void RenderWidgetHostViewAndroid::OnSwapCompositorFrame( |
1072 uint32_t output_surface_id, | 1074 uint32_t output_surface_id, |
| 1075 const cc::SurfaceId& surface_id, |
1073 cc::CompositorFrame frame) { | 1076 cc::CompositorFrame frame) { |
1074 InternalSwapCompositorFrame(output_surface_id, std::move(frame)); | 1077 InternalSwapCompositorFrame(output_surface_id, surface_id, std::move(frame)); |
1075 } | 1078 } |
1076 | 1079 |
1077 void RenderWidgetHostViewAndroid::ClearCompositorFrame() { | 1080 void RenderWidgetHostViewAndroid::ClearCompositorFrame() { |
1078 DestroyDelegatedContent(); | 1081 DestroyDelegatedContent(); |
1079 } | 1082 } |
1080 | 1083 |
1081 void RenderWidgetHostViewAndroid::RetainFrame(uint32_t output_surface_id, | 1084 void RenderWidgetHostViewAndroid::RetainFrame(uint32_t output_surface_id, |
1082 cc::CompositorFrame frame) { | 1085 cc::CompositorFrame frame) { |
1083 DCHECK(locks_on_frame_count_); | 1086 DCHECK(locks_on_frame_count_); |
1084 | 1087 |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 case ui::MotionEvent::ACTION_UP: | 1999 case ui::MotionEvent::ACTION_UP: |
1997 case ui::MotionEvent::ACTION_POINTER_UP: | 2000 case ui::MotionEvent::ACTION_POINTER_UP: |
1998 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2001 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
1999 delta.InMicroseconds(), 1, 1000000, 50); | 2002 delta.InMicroseconds(), 1, 1000000, 50); |
2000 default: | 2003 default: |
2001 return; | 2004 return; |
2002 } | 2005 } |
2003 } | 2006 } |
2004 | 2007 |
2005 } // namespace content | 2008 } // namespace content |
OLD | NEW |