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 {
class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
public:
explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* layer_tree_host_impl);
explicit ScrollElasticityHelperImpl(LayerTreeHostImpl* host_impl);
~ScrollElasticityHelperImpl() override;
bool IsUserScrollable() const override;
......@@ -25,19 +25,18 @@ class ScrollElasticityHelperImpl : public ScrollElasticityHelper {
void RequestOneBeginFrame() override;
private:
LayerTreeHostImpl* layer_tree_host_impl_;
LayerTreeHostImpl* host_impl_;
};
ScrollElasticityHelperImpl::ScrollElasticityHelperImpl(
LayerTreeHostImpl* layer_tree)
: layer_tree_host_impl_(layer_tree) {
}
: host_impl_(layer_tree) {}
ScrollElasticityHelperImpl::~ScrollElasticityHelperImpl() {
}
bool ScrollElasticityHelperImpl::IsUserScrollable() const {
const auto* scroll_node = layer_tree_host_impl_->OuterViewportScrollNode();
const auto* scroll_node = host_impl_->OuterViewportScrollNode();
if (!scroll_node)
return false;
return scroll_node->user_scrollable_horizontal ||
......@@ -45,8 +44,7 @@ bool ScrollElasticityHelperImpl::IsUserScrollable() const {
}
gfx::Vector2dF ScrollElasticityHelperImpl::StretchAmount() const {
return layer_tree_host_impl_->active_tree()->elastic_overscroll()->Current(
true);
return host_impl_->active_tree()->elastic_overscroll()->Current(true);
}
void ScrollElasticityHelperImpl::SetStretchAmount(
......@@ -54,39 +52,37 @@ void ScrollElasticityHelperImpl::SetStretchAmount(
if (stretch_amount == StretchAmount())
return;
layer_tree_host_impl_->active_tree()->elastic_overscroll()->SetCurrent(
stretch_amount);
layer_tree_host_impl_->active_tree()->set_needs_update_draw_properties();
layer_tree_host_impl_->SetNeedsCommit();
layer_tree_host_impl_->SetNeedsRedraw();
layer_tree_host_impl_->SetFullViewportDamage();
host_impl_->active_tree()->elastic_overscroll()->SetCurrent(stretch_amount);
host_impl_->active_tree()->set_needs_update_draw_properties();
host_impl_->SetNeedsCommit();
host_impl_->SetNeedsRedraw();
host_impl_->SetFullViewportDamage();
}
gfx::ScrollOffset ScrollElasticityHelperImpl::ScrollOffset() const {
return layer_tree_host_impl_->active_tree()->TotalScrollOffset();
return host_impl_->active_tree()->TotalScrollOffset();
}
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) {
LayerImpl* root_scroll_layer =
layer_tree_host_impl_->OuterViewportScrollLayer()
? layer_tree_host_impl_->OuterViewportScrollLayer()
: layer_tree_host_impl_->InnerViewportScrollLayer();
LayerImpl* root_scroll_layer = host_impl_->OuterViewportScrollLayer()
? host_impl_->OuterViewportScrollLayer()
: host_impl_->InnerViewportScrollLayer();
if (root_scroll_layer)
root_scroll_layer->ScrollBy(delta);
}
void ScrollElasticityHelperImpl::RequestOneBeginFrame() {
layer_tree_host_impl_->SetNeedsOneBeginImplFrame();
host_impl_->SetNeedsOneBeginImplFrame();
}
// static
ScrollElasticityHelper* ScrollElasticityHelper::CreateForLayerTreeHostImpl(
LayerTreeHostImpl* layer_tree_host_impl) {
return new ScrollElasticityHelperImpl(layer_tree_host_impl);
LayerTreeHostImpl* host_impl) {
return new ScrollElasticityHelperImpl(host_impl);
}
} // namespace cc
......@@ -48,7 +48,7 @@ class LayerTreeHostImpl;
class CC_EXPORT ScrollElasticityHelper {
public:
static ScrollElasticityHelper* CreateForLayerTreeHostImpl(
LayerTreeHostImpl* layer_tree_host_impl);
LayerTreeHostImpl* host_impl);
virtual ~ScrollElasticityHelper() {}
......
......@@ -43,9 +43,8 @@ namespace cc {
LatencyInfoSwapPromiseMonitor::LatencyInfoSwapPromiseMonitor(
ui::LatencyInfo* latency,
SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl)
: SwapPromiseMonitor(swap_promise_manager, layer_tree_host_impl),
latency_(latency) {}
LayerTreeHostImpl* host_impl)
: SwapPromiseMonitor(swap_promise_manager, host_impl), latency_(latency) {}
LatencyInfoSwapPromiseMonitor::~LatencyInfoSwapPromiseMonitor() {
}
......@@ -66,8 +65,7 @@ void LatencyInfoSwapPromiseMonitor::OnSetNeedsRedrawOnImpl() {
// measurement of the time to the next SwapBuffers(). The swap
// promise is pinned so that it is not interrupted by new incoming
// activations (which would otherwise break the swap promise).
layer_tree_host_impl_->active_tree()->QueuePinnedSwapPromise(
std::move(swap_promise));
host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise));
}
}
......@@ -98,7 +96,7 @@ void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() {
new_sequence_number, "ScrollUpdate");
std::unique_ptr<SwapPromise> swap_promise(
new LatencyInfoSwapPromise(new_latency));
layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
std::move(swap_promise));
}
}
......
......@@ -21,7 +21,7 @@ class CC_EXPORT LatencyInfoSwapPromiseMonitor : public SwapPromiseMonitor {
public:
LatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency,
SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl);
LayerTreeHostImpl* host_impl);
~LatencyInfoSwapPromiseMonitor() override;
void OnSetNeedsCommitOnMain() override;
......
This diff is collapsed.
......@@ -91,7 +91,7 @@ class CC_EXPORT LayerTreeImpl {
// This is the number of times a fixed point has to be hit continuously by a
// layer to consider it as jittering.
enum : int { kFixedPointHitsThreshold = 3 };
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl,
LayerTreeImpl(LayerTreeHostImpl* host_impl,
scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio,
scoped_refptr<SyncedElasticOverscroll> elastic_overscroll);
......@@ -135,9 +135,7 @@ class CC_EXPORT LayerTreeImpl {
bool RequiresHighResToDraw() const;
bool SmoothnessTakesPriority() const;
VideoFrameControllerClient* GetVideoFrameControllerClient() const;
MutatorHost* mutator_host() const {
return layer_tree_host_impl_->mutator_host();
}
MutatorHost* mutator_host() const { return host_impl_->mutator_host(); }
// Tree specific methods exposed to layer-impl tree.
// ---------------------------------------------------------------------------
......@@ -338,8 +336,7 @@ class CC_EXPORT LayerTreeImpl {
}
bool is_in_resourceless_software_draw_mode() {
return (layer_tree_host_impl_->GetDrawMode() ==
DRAW_MODE_RESOURCELESS_SOFTWARE);
return (host_impl_->GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE);
}
void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; }
......@@ -414,7 +411,7 @@ class CC_EXPORT LayerTreeImpl {
bool DistributeRootScrollOffset(const gfx::ScrollOffset& root_offset);
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.
......@@ -561,7 +558,7 @@ class CC_EXPORT LayerTreeImpl {
void PushBrowserControls(const float* top_controls_shown_ratio);
bool ClampBrowserControlsShownRatio();
LayerTreeHostImpl* layer_tree_host_impl_;
LayerTreeHostImpl* host_impl_;
int source_frame_number_;
int is_first_frame_after_commit_tracker_;
LayerImpl* root_layer_for_testing_;
......
This diff is collapsed.
......@@ -148,7 +148,7 @@ class CC_EXPORT ProxyImpl : public LayerTreeHostImplClient,
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.
BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_;
......
This diff is collapsed.
......@@ -142,7 +142,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy,
// Used on the Thread, but checked on main thread during
// initialization/shutdown.
std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
std::unique_ptr<LayerTreeHostImpl> host_impl_;
// Accessed from both threads.
std::unique_ptr<Scheduler> scheduler_on_impl_thread_;
......
......@@ -10,22 +10,21 @@
namespace cc {
SwapPromiseMonitor::SwapPromiseMonitor(SwapPromiseManager* swap_promise_manager,
LayerTreeHostImpl* layer_tree_host_impl)
: swap_promise_manager_(swap_promise_manager),
layer_tree_host_impl_(layer_tree_host_impl) {
DCHECK((swap_promise_manager && !layer_tree_host_impl) ||
(!swap_promise_manager && layer_tree_host_impl));
LayerTreeHostImpl* host_impl)
: swap_promise_manager_(swap_promise_manager), host_impl_(host_impl) {
DCHECK((swap_promise_manager && !host_impl) ||
(!swap_promise_manager && host_impl));
if (swap_promise_manager)
swap_promise_manager->InsertSwapPromiseMonitor(this);
if (layer_tree_host_impl_)
layer_tree_host_impl_->InsertSwapPromiseMonitor(this);
if (host_impl_)
host_impl_->InsertSwapPromiseMonitor(this);
}
SwapPromiseMonitor::~SwapPromiseMonitor() {
if (swap_promise_manager_)
swap_promise_manager_->RemoveSwapPromiseMonitor(this);
if (layer_tree_host_impl_)
layer_tree_host_impl_->RemoveSwapPromiseMonitor(this);
if (host_impl_)
host_impl_->RemoveSwapPromiseMonitor(this);
}
} // namespace cc
......@@ -23,12 +23,12 @@ class LayerTreeHostImpl;
// will unregister itself from SwapPromiseManager or LayerTreeHostImpl.
class CC_EXPORT SwapPromiseMonitor {
public:
// If the monitor lives on the main thread, pass in swap_promise_manager tied
// to the LayerTreeHost and set layer_tree_host_impl to nullptr.
// If the monitor lives on the impl thread, pass in layer_tree_host_impl
// and set layer_tree_host to nullptr.
// If the monitor lives on the main thread, pass in |swap_promise_manager|
// tied to the LayerTreeHost and set |host_impl| to nullptr. If the monitor
// lives on the impl thread, pass in |host_impl| and set |layer_tree_host| to
// nullptr.
SwapPromiseMonitor(SwapPromiseManager* swap_promise_managaer,
LayerTreeHostImpl* layer_tree_host_impl);
LayerTreeHostImpl* host_impl);
virtual ~SwapPromiseMonitor();
virtual void OnSetNeedsCommitOnMain() = 0;
......@@ -37,7 +37,7 @@ class CC_EXPORT SwapPromiseMonitor {
protected:
SwapPromiseManager* swap_promise_manager_;
LayerTreeHostImpl* layer_tree_host_impl_;
LayerTreeHostImpl* host_impl_;
};
} // 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