Commit aa326e48 authored by Walter Korman's avatar Walter Korman Committed by Commit Bot

Brevity for LayerTreeHostImpl references.

There is minimal ambiguity for tree related classes to reference the
LayerTreeHostImpl as host_impl rather than layer_tree_host_impl, and
reasonably high value from shorter code.

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ifb4e1c098ba8aa840aaa5c2ccf91e5b525a4be8b
Reviewed-on: https://chromium-review.googlesource.com/627389Reviewed-by: default avatarVladimir Levin <vmpstr@chromium.org>
Commit-Queue: Walter Korman <wkorman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496489}
parent 6d158ab8
...@@ -13,7 +13,7 @@ namespace cc { ...@@ -13,7 +13,7 @@ namespace cc {
class ScrollElasticityHelperImpl : public ScrollElasticityHelper { class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
public: public:
explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* layer_tree_host_impl); explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* host_impl);
~ScrollElasticityHelperImpl() override; ~ScrollElasticityHelperImpl() override;
bool IsUserScrollable() const override; bool IsUserScrollable() const override;
...@@ -25,19 +25,18 @@ class ScrollElasticityHelperImpl : public ScrollElasticityHelper { ...@@ -25,19 +25,18 @@ class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
void RequestOneBeginFrame() override; void RequestOneBeginFrame() override;
private: private:
LayerTreeHostImpl* layer_tree_host_impl_; LayerTreeHostImpl* host_impl_;
}; };
ScrollElasticityHelperImpl::ScrollElasticityHelperImpl( ScrollElasticityHelperImpl::ScrollElasticityHelperImpl(
LayerTreeHostImpl* layer_tree) LayerTreeHostImpl* layer_tree)
: layer_tree_host_impl_(layer_tree) { : host_impl_(layer_tree) {}
}
ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() { ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() {
} }
bool ScrollElasticityHelperImpl::IsUserScrollable() const { bool ScrollElasticityHelperImpl::IsUserScrollable() const {
const auto* scroll_node = layer_tree_host_impl_->OuterViewportScrollNode(); const auto* scroll_node = host_impl_->OuterViewportScrollNode();
if (!scroll_node) if (!scroll_node)
return false; return false;
return scroll_node->user_scrollable_horizontal || return scroll_node->user_scrollable_horizontal ||
...@@ -45,8 +44,7 @@ bool ScrollElasticityHelperImpl::IsUserScrollable() const { ...@@ -45,8 +44,7 @@ bool ScrollElasticityHelperImpl::IsUserScrollable() const {
} }
gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const { gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const {
return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current( return host_impl_->active_tree()->elastic_overscroll()->Current(true);
true);
} }
void ScrollElasticityHelperImpl::SetStretchAmount( void ScrollElasticityHelperImpl::SetStretchAmount(
...@@ -54,39 +52,37 @@ void ScrollElasticityHelperImpl::SetStretchAmount( ...@@ -54,39 +52,37 @@ void ScrollElasticityHelperImpl::SetStretchAmount(
if (stretch_amount == StretchAmount()) if (stretch_amount == StretchAmount())
return; return;
layer_tree_host_impl_->active_tree()->elastic_overscroll()->SetCurrent( host_impl_->active_tree()->elastic_overscroll()->SetCurrent(stretch_amount);
stretch_amount); host_impl_->active_tree()->set_needs_update_draw_properties();
layer_tree_host_impl_->active_tree()->set_needs_update_draw_properties(); host_impl_->SetNeedsCommit();
layer_tree_host_impl_->SetNeedsCommit(); host_impl_->SetNeedsRedraw();
layer_tree_host_impl_->SetNeedsRedraw(); host_impl_->SetFullViewportDamage();
layer_tree_host_impl_->SetFullViewportDamage();
} }
gfx::ScrollOffset ScrollElasticityHelperImpl::ScrollOffset() const { gfx::ScrollOffset ScrollElasticityHelperImpl::ScrollOffset() const {
return layer_tree_host_impl_->active_tree()->TotalScrollOffset(); return host_impl_->active_tree()->TotalScrollOffset();
} }
gfx::ScrollOffset ScrollElasticityHelperImpl::MaxScrollOffset() const { gfx::ScrollOffset ScrollElasticityHelperImpl::MaxScrollOffset() const {
return layer_tree_host_impl_->active_tree()->TotalMaxScrollOffset(); return host_impl_->active_tree()->TotalMaxScrollOffset();
} }
void ScrollElasticityHelperImpl::ScrollBy(const gfx::Vector2dF& delta) { void ScrollElasticityHelperImpl::ScrollBy(const gfx::Vector2dF& delta) {
LayerImpl* root_scroll_layer = LayerImpl* root_scroll_layer = host_impl_->OuterViewportScrollLayer()
layer_tree_host_impl_->OuterViewportScrollLayer() ? host_impl_->OuterViewportScrollLayer()
? layer_tree_host_impl_->OuterViewportScrollLayer() : host_impl_->InnerViewportScrollLayer();
: layer_tree_host_impl_->InnerViewportScrollLayer();
if (root_scroll_layer) if (root_scroll_layer)
root_scroll_layer->ScrollBy(delta); root_scroll_layer->ScrollBy(delta);
} }
void ScrollElasticityHelperImpl::RequestOneBeginFrame() { void ScrollElasticityHelperImpl::RequestOneBeginFrame() {
layer_tree_host_impl_->SetNeedsOneBeginImplFrame(); host_impl_->SetNeedsOneBeginImplFrame();
} }
// static // static
ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl( ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl(
LayerTreeHostImpl* layer_tree_host_impl) { LayerTreeHostImpl* host_impl) {
return new ScrollElasticityHelperImpl(layer_tree_host_impl); return new ScrollElasticityHelperImpl(host_impl);
} }
} // namespace cc } // namespace cc
...@@ -48,7 +48,7 @@ class LayerTreeHostImpl; ...@@ -48,7 +48,7 @@ class LayerTreeHostImpl;
class CC_EXPORT ScrollElasticityHelper { class CC_EXPORT ScrollElasticityHelper {
public: public:
static ScrollElasticityHelper* CreateForLayerTreeHostImpl( static ScrollElasticityHelper* CreateForLayerTreeHostImpl(
LayerTreeHostImpl* layer_tree_host_impl); LayerTreeHostImpl* host_impl);
virtual ~ScrollElasticityHelper() {} virtual ~ScrollElasticityHelper() {}
......
...@@ -43,9 +43,8 @@ namespace cc { ...@@ -43,9 +43,8 @@ namespace cc {
LatencyInfoSwapPromiseMonitor::LatencyInfoSwapPromiseMonitor( LatencyInfoSwapPromiseMonitor::LatencyInfoSwapPromiseMonitor(
ui::LatencyInfo* latency, ui::LatencyInfo* latency,
SwapPromiseManager* swap_promise_manager, SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl) LayerTreeHostImpl* host_impl)
: SwapPromiseMonitor(swap_promise_manager, layer_tree_host_impl), : SwapPromiseMonitor(swap_promise_manager, host_impl), latency_(latency) {}
latency_(latency) {}
LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() { LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {
} }
...@@ -66,8 +65,7 @@ void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() { ...@@ -66,8 +65,7 @@ void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() {
// measurement of the time to the next SwapBuffers(). The swap // measurement of the time to the next SwapBuffers(). The swap
// promise is pinned so that it is not interrupted by new incoming // promise is pinned so that it is not interrupted by new incoming
// activations (which would otherwise break the swap promise). // activations (which would otherwise break the swap promise).
layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise( host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise));
std::move(swap_promise));
} }
} }
...@@ -98,7 +96,7 @@ void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { ...@@ -98,7 +96,7 @@ void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() {
new_sequence_number, "ScrollUpdate"); new_sequence_number, "ScrollUpdate");
std::unique_ptr<SwapPromise> swap_promise( std::unique_ptr<SwapPromise> swap_promise(
new LatencyInfoSwapPromise(new_latency)); new LatencyInfoSwapPromise(new_latency));
layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
std::move(swap_promise)); std::move(swap_promise));
} }
} }
......
...@@ -21,7 +21,7 @@ class CC_EXPORT LatencyInfoSwapPromiseMonitor : public SwapPromiseMonitor { ...@@ -21,7 +21,7 @@ class CC_EXPORT LatencyInfoSwapPromiseMonitor : public SwapPromiseMonitor {
public: public:
LatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency, LatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency,
SwapPromiseManager* swap_promise_manager, SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl); LayerTreeHostImpl* host_impl);
~LatencyInfoSwapPromiseMonitor() override; ~LatencyInfoSwapPromiseMonitor() override;
void OnSetNeedsCommitOnMain() override; void OnSetNeedsCommitOnMain() override;
......
This diff is collapsed.
...@@ -91,7 +91,7 @@ class CC_EXPORT LayerTreeImpl { ...@@ -91,7 +91,7 @@ class CC_EXPORT LayerTreeImpl {
// This is the number of times a fixed point has to be hit continuously by a // This is the number of times a fixed point has to be hit continuously by a
// layer to consider it as jittering. // layer to consider it as jittering.
enum : int { kFixedPointHitsThreshold = 3 }; enum : int { kFixedPointHitsThreshold = 3 };
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl, LayerTreeImpl(LayerTreeHostImpl* host_impl,
scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio, scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio,
scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); scoped_refptr<SyncedElasticOverscroll> elastic_overscroll);
...@@ -135,9 +135,7 @@ class CC_EXPORT LayerTreeImpl { ...@@ -135,9 +135,7 @@ class CC_EXPORT LayerTreeImpl {
bool RequiresHighResToDraw() const; bool RequiresHighResToDraw() const;
bool SmoothnessTakesPriority() const; bool SmoothnessTakesPriority() const;
VideoFrameControllerClient* GetVideoFrameControllerClient() const; VideoFrameControllerClient* GetVideoFrameControllerClient() const;
MutatorHost* mutator_host() const { MutatorHost* mutator_host() const { return host_impl_->mutator_host(); }
return layer_tree_host_impl_->mutator_host();
}
// Tree specific methods exposed to layer-impl tree. // Tree specific methods exposed to layer-impl tree.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -338,8 +336,7 @@ class CC_EXPORT LayerTreeImpl { ...@@ -338,8 +336,7 @@ class CC_EXPORT LayerTreeImpl {
} }
bool is_in_resourceless_software_draw_mode() { bool is_in_resourceless_software_draw_mode() {
return (layer_tree_host_impl_->GetDrawMode() == return (host_impl_->GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE);
DRAW_MODE_RESOURCELESS_SOFTWARE);
} }
void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; } void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; }
...@@ -414,7 +411,7 @@ class CC_EXPORT LayerTreeImpl { ...@@ -414,7 +411,7 @@ class CC_EXPORT LayerTreeImpl {
bool DistributeRootScrollOffset(const gfx::ScrollOffset& root_offset); bool DistributeRootScrollOffset(const gfx::ScrollOffset& root_offset);
void ApplyScroll(ScrollNode* scroll_node, ScrollState* scroll_state) { void ApplyScroll(ScrollNode* scroll_node, ScrollState* scroll_state) {
layer_tree_host_impl_->ApplyScroll(scroll_node, scroll_state); host_impl_->ApplyScroll(scroll_node, scroll_state);
} }
// Call this function when you expect there to be a swap buffer. // Call this function when you expect there to be a swap buffer.
...@@ -561,7 +558,7 @@ class CC_EXPORT LayerTreeImpl { ...@@ -561,7 +558,7 @@ class CC_EXPORT LayerTreeImpl {
void PushBrowserControls(const float* top_controls_shown_ratio); void PushBrowserControls(const float* top_controls_shown_ratio);
bool ClampBrowserControlsShownRatio(); bool ClampBrowserControlsShownRatio();
LayerTreeHostImpl* layer_tree_host_impl_; LayerTreeHostImpl* host_impl_;
int source_frame_number_; int source_frame_number_;
int is_first_frame_after_commit_tracker_; int is_first_frame_after_commit_tracker_;
LayerImpl* root_layer_for_testing_; LayerImpl* root_layer_for_testing_;
......
This diff is collapsed.
...@@ -148,7 +148,7 @@ class CC_EXPORT ProxyImpl : public LayerTreeHostImplClient, ...@@ -148,7 +148,7 @@ class CC_EXPORT ProxyImpl : public LayerTreeHostImplClient,
RenderingStatsInstrumentation* rendering_stats_instrumentation_; RenderingStatsInstrumentation* rendering_stats_instrumentation_;
std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; std::unique_ptr<LayerTreeHostImpl> host_impl_;
// Use accessors instead of this variable directly. // Use accessors instead of this variable directly.
BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_;
......
This diff is collapsed.
...@@ -142,7 +142,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy, ...@@ -142,7 +142,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy,
// Used on the Thread, but checked on main thread during // Used on the Thread, but checked on main thread during
// initialization/shutdown. // initialization/shutdown.
std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; std::unique_ptr<LayerTreeHostImpl> host_impl_;
// Accessed from both threads. // Accessed from both threads.
std::unique_ptr<Scheduler> scheduler_on_impl_thread_; std::unique_ptr<Scheduler> scheduler_on_impl_thread_;
......
...@@ -10,22 +10,21 @@ ...@@ -10,22 +10,21 @@
namespace cc { namespace cc {
SwapPromiseMonitor::SwapPromiseMonitor(SwapPromiseManager* swap_promise_manager, SwapPromiseMonitor::SwapPromiseMonitor(SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl) LayerTreeHostImpl* host_impl)
: swap_promise_manager_(swap_promise_manager), : swap_promise_manager_(swap_promise_manager), host_impl_(host_impl) {
layer_tree_host_impl_(layer_tree_host_impl) { DCHECK((swap_promise_manager && !host_impl) ||
DCHECK((swap_promise_manager && !layer_tree_host_impl) || (!swap_promise_manager && host_impl));
(!swap_promise_manager && layer_tree_host_impl));
if (swap_promise_manager) if (swap_promise_manager)
swap_promise_manager->InsertSwapPromiseMonitor(this); swap_promise_manager->InsertSwapPromiseMonitor(this);
if (layer_tree_host_impl_) if (host_impl_)
layer_tree_host_impl_->InsertSwapPromiseMonitor(this); host_impl_->InsertSwapPromiseMonitor(this);
} }
SwapPromiseMonitor::~SwapPromiseMonitor() { SwapPromiseMonitor::~SwapPromiseMonitor() {
if (swap_promise_manager_) if (swap_promise_manager_)
swap_promise_manager_->RemoveSwapPromiseMonitor(this); swap_promise_manager_->RemoveSwapPromiseMonitor(this);
if (layer_tree_host_impl_) if (host_impl_)
layer_tree_host_impl_->RemoveSwapPromiseMonitor(this); host_impl_->RemoveSwapPromiseMonitor(this);
} }
} // namespace cc } // namespace cc
...@@ -23,12 +23,12 @@ class LayerTreeHostImpl; ...@@ -23,12 +23,12 @@ class LayerTreeHostImpl;
// will unregister itself from SwapPromiseManager or LayerTreeHostImpl. // will unregister itself from SwapPromiseManager or LayerTreeHostImpl.
class CC_EXPORT SwapPromiseMonitor { class CC_EXPORT SwapPromiseMonitor {
public: public:
// If the monitor lives on the main thread, pass in swap_promise_manager tied // If the monitor lives on the main thread, pass in |swap_promise_manager|
// to the LayerTreeHost and set layer_tree_host_impl to nullptr. // tied to the LayerTreeHost and set |host_impl| to nullptr. If the monitor
// If the monitor lives on the impl thread, pass in layer_tree_host_impl // lives on the impl thread, pass in |host_impl| and set |layer_tree_host| to
// and set layer_tree_host to nullptr. // nullptr.
SwapPromiseMonitor(SwapPromiseManager* swap_promise_managaer, SwapPromiseMonitor(SwapPromiseManager* swap_promise_managaer,
LayerTreeHostImpl* layer_tree_host_impl); LayerTreeHostImpl* host_impl);
virtual ~SwapPromiseMonitor(); virtual ~SwapPromiseMonitor();
virtual void OnSetNeedsCommitOnMain() = 0; virtual void OnSetNeedsCommitOnMain() = 0;
...@@ -37,7 +37,7 @@ class CC_EXPORT SwapPromiseMonitor { ...@@ -37,7 +37,7 @@ class CC_EXPORT SwapPromiseMonitor {
protected: protected:
SwapPromiseManager* swap_promise_manager_; SwapPromiseManager* swap_promise_manager_;
LayerTreeHostImpl* layer_tree_host_impl_; LayerTreeHostImpl* host_impl_;
}; };
} // namespace cc } // namespace cc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment