| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index eddbc60b09655a7594d09a16f089205f8d945bee..2f4d9a9b057cdbb9c21264f24606b5cc6b671726 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -241,12 +241,10 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| TRACE_EVENT_OBJECT_CREATED_WITH_ID(
|
| TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_);
|
|
|
| - if (settings.calculate_top_controls_position) {
|
| - top_controls_manager_ =
|
| - TopControlsManager::Create(this,
|
| - settings.top_controls_show_threshold,
|
| - settings.top_controls_hide_threshold);
|
| - }
|
| + top_controls_manager_ =
|
| + TopControlsManager::Create(this,
|
| + settings.top_controls_show_threshold,
|
| + settings.top_controls_hide_threshold);
|
| }
|
|
|
| LayerTreeHostImpl::~LayerTreeHostImpl() {
|
| @@ -916,8 +914,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
|
| }
|
|
|
| void LayerTreeHostImpl::MainThreadHasStoppedFlinging() {
|
| - if (top_controls_manager_)
|
| - top_controls_manager_->MainThreadHasStoppedFlinging();
|
| + top_controls_manager_->MainThreadHasStoppedFlinging();
|
| if (input_handler_client_)
|
| input_handler_client_->MainThreadHasStoppedFlinging();
|
| }
|
| @@ -1423,12 +1420,10 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
|
| metadata.root_layer_size = active_tree_->ScrollableSize();
|
| metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
|
| metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
|
| - if (top_controls_manager_) {
|
| - metadata.location_bar_offset =
|
| - gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset());
|
| - metadata.location_bar_content_translation =
|
| - gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset());
|
| - }
|
| + metadata.location_bar_offset =
|
| + gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset());
|
| + metadata.location_bar_content_translation =
|
| + gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset());
|
|
|
| active_tree_->GetViewportSelection(&metadata.selection_start,
|
| &metadata.selection_end);
|
| @@ -1453,10 +1448,6 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
|
| return metadata;
|
| }
|
|
|
| -static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) {
|
| - layer->DidBeginTracing();
|
| -}
|
| -
|
| void LayerTreeHostImpl::DrawLayers(FrameData* frame,
|
| base::TimeTicks frame_begin_time) {
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
|
| @@ -1506,11 +1497,11 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
|
| if (pending_tree_) {
|
| LayerTreeHostCommon::CallFunctionForSubtree(
|
| pending_tree_->root_layer(),
|
| - base::Bind(&LayerTreeHostImplDidBeginTracingCallback));
|
| + [](LayerImpl* layer) { layer->DidBeginTracing(); });
|
| }
|
| LayerTreeHostCommon::CallFunctionForSubtree(
|
| active_tree_->root_layer(),
|
| - base::Bind(&LayerTreeHostImplDidBeginTracingCallback));
|
| + [](LayerImpl* layer) { layer->DidBeginTracing(); });
|
| }
|
|
|
| {
|
| @@ -1662,7 +1653,7 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() {
|
| LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer();
|
| LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer();
|
|
|
| - if (!inner_container || !top_controls_manager_)
|
| + if (!inner_container)
|
| return;
|
|
|
| ViewportAnchor anchor(InnerViewportScrollLayer(),
|
| @@ -2360,8 +2351,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
|
| InputHandler::ScrollInputType type) {
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
|
|
|
| - if (top_controls_manager_)
|
| - top_controls_manager_->ScrollBegin();
|
| + top_controls_manager_->ScrollBegin();
|
|
|
| DCHECK(!CurrentlyScrollingLayer());
|
| ClearCurrentlyScrollingLayer();
|
| @@ -2572,9 +2562,6 @@ bool LayerTreeHostImpl::ShouldTopControlsConsumeScroll(
|
| const gfx::Vector2dF& scroll_delta) const {
|
| DCHECK(CurrentlyScrollingLayer());
|
|
|
| - if (!top_controls_manager_)
|
| - return false;
|
| -
|
| // Always consume if it's in the direction to show the top controls.
|
| if (scroll_delta.y() < 0)
|
| return true;
|
| @@ -2815,8 +2802,7 @@ void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() {
|
| }
|
|
|
| void LayerTreeHostImpl::ScrollEnd() {
|
| - if (top_controls_manager_)
|
| - top_controls_manager_->ScrollEnd();
|
| + top_controls_manager_->ScrollEnd();
|
| ClearCurrentlyScrollingLayer();
|
| }
|
|
|
| @@ -2937,8 +2923,7 @@ void LayerTreeHostImpl::PinchGestureBegin() {
|
| active_tree_->SetCurrentlyScrollingLayer(
|
| active_tree_->InnerViewportScrollLayer());
|
| }
|
| - if (top_controls_manager_)
|
| - top_controls_manager_->PinchBegin();
|
| + top_controls_manager_->PinchBegin();
|
| }
|
|
|
| void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta,
|
| @@ -2997,8 +2982,7 @@ void LayerTreeHostImpl::PinchGestureEnd() {
|
| pinch_gesture_end_should_clear_scrolling_layer_ = false;
|
| ClearCurrentlyScrollingLayer();
|
| }
|
| - if (top_controls_manager_)
|
| - top_controls_manager_->PinchEnd();
|
| + top_controls_manager_->PinchEnd();
|
| client_->SetNeedsCommitOnImplThread();
|
| // When a pinch ends, we may be displaying content cached at incorrect scales,
|
| // so updating draw properties and drawing will ensure we are using the right
|
| @@ -3093,7 +3077,7 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
|
| }
|
|
|
| void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
|
| - if (!top_controls_manager_ || !top_controls_manager_->animation())
|
| + if (!top_controls_manager_->animation())
|
| return;
|
|
|
| gfx::Vector2dF scroll = top_controls_manager_->Animate(time);
|
|
|