Commit 8d6c46f3 authored by danakj's avatar danakj Committed by Commit Bot

cc: Document the remaining public and protected methods of cc::Layer

The impl-side SetTrilinearFiltering() is unused, since it is only used
for property tree building, and on the impl-side it comes from the
test properties. So it's removed.

R=weiliangc@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ib9a726dbaa45665a0cd6c585a69e2f7800db78fa
Reviewed-on: https://chromium-review.googlesource.com/1105348
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568535}
parent 907fe4ac
...@@ -1230,8 +1230,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { ...@@ -1230,8 +1230,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
layer->SetNeedsPushProperties(); layer->SetNeedsPushProperties();
layer->SetTrilinearFiltering(trilinear_filtering());
// Reset any state that should be cleared for the next update. // Reset any state that should be cleared for the next update.
needs_show_scrollbars_ = false; needs_show_scrollbars_ = false;
subtree_property_changed_ = false; subtree_property_changed_ = false;
...@@ -1365,6 +1363,11 @@ void Layer::SetTrilinearFiltering(bool trilinear_filtering) { ...@@ -1365,6 +1363,11 @@ void Layer::SetTrilinearFiltering(bool trilinear_filtering) {
if (inputs_.trilinear_filtering == trilinear_filtering) if (inputs_.trilinear_filtering == trilinear_filtering)
return; return;
inputs_.trilinear_filtering = trilinear_filtering; inputs_.trilinear_filtering = trilinear_filtering;
// When true, makes a RenderSurface which makes an effect node.
SetPropertyTreesNeedRebuild();
// Adding a RenderSurface may change how things in the subtree appear, since
// it flattens transforms.
SetSubtreePropertyChanged();
SetNeedsCommit(); SetNeedsCommit();
} }
......
...@@ -545,8 +545,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -545,8 +545,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void SetHideLayerAndSubtree(bool hide); void SetHideLayerAndSubtree(bool hide);
bool hide_layer_and_subtree() const { return inputs_.hide_layer_and_subtree; } bool hide_layer_and_subtree() const { return inputs_.hide_layer_and_subtree; }
void UpdateDebugInfo();
// The index of this layer's node in the various property trees. These are // The index of this layer's node in the various property trees. These are
// only valid after a main frame, when Update() is called on the layer, and // only valid after a main frame, when Update() is called on the layer, and
// remain valid and in in the same state until the next main frame, or until // remain valid and in in the same state until the next main frame, or until
...@@ -562,6 +560,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -562,6 +560,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void SetHasTransformNode(bool val) { has_transform_node_ = val; } void SetHasTransformNode(bool val) { has_transform_node_ = val; }
bool has_transform_node() { return has_transform_node_; } bool has_transform_node() { return has_transform_node_; }
// Sets that the content shown in this layer may be a video. This may be used
// by the system compositor to distinguish between animations updating the
// screen and video, which the user would be watching. This allows
// optimizations like turning off the display when video is not playing,
// without interfering with video playback.
void SetMayContainVideo(bool yes); void SetMayContainVideo(bool yes);
// Stable identifier for clients. See comment in cc/trees/element_id.h. // Stable identifier for clients. See comment in cc/trees/element_id.h.
...@@ -579,13 +582,15 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -579,13 +582,15 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
return inputs_.has_will_change_transform_hint; return inputs_.has_will_change_transform_hint;
} }
// Sets or gets if trilinear filtering should be used to scaling the contents
// of this layer and its subtree. When set the layer and its subtree will be
// composited together as a single unit, mip maps will be generated of the
// subtree together, and trilinear filtering applied when supported, if
// scaling during composite of the content from this layer and its subtree
// into the target.
void SetTrilinearFiltering(bool trilinear_filtering); void SetTrilinearFiltering(bool trilinear_filtering);
bool trilinear_filtering() const { return inputs_.trilinear_filtering; } bool trilinear_filtering() const { return inputs_.trilinear_filtering; }
ElementListType GetElementTypeForAnimation() const;
void SetScrollbarsHiddenFromImplSide(bool hidden);
// Called on the scroll layer to trigger showing the overlay scrollbars. // Called on the scroll layer to trigger showing the overlay scrollbars.
void ShowScrollbars() { needs_show_scrollbars_ = true; } void ShowScrollbars() { needs_show_scrollbars_ = true; }
...@@ -595,6 +600,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -595,6 +600,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
// display. // display.
virtual sk_sp<SkPicture> GetPicture() const; virtual sk_sp<SkPicture> GetPicture() const;
// For tracing. Calls out to the LayerClient to get tracing data that will
// be attached to this layer's tracing outputs under the 'debug_info' key.
void UpdateDebugInfo();
// For telemetry testing. Runs a given test behaviour implemented in // For telemetry testing. Runs a given test behaviour implemented in
// |benchmark| for this layer. The base class does nothing as benchmarks // |benchmark| for this layer. The base class does nothing as benchmarks
// only exist for subclass layer types. For each subclass that the // only exist for subclass layer types. For each subclass that the
...@@ -664,6 +673,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -664,6 +673,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
// was called before it. // was called before it.
void SetNeedsPushProperties(); void SetNeedsPushProperties();
// Internal method to call the LayerClient, if there is one, to inform it when
// overlay scrollbars have been completely hidden (due to lack of scrolling by
// the user).
void SetScrollbarsHiddenFromImplSide(bool hidden);
// Internal to property tree construction. A generation number for the // Internal to property tree construction. A generation number for the
// property trees, to verify the layer's indices are pointers into the trees // property trees, to verify the layer's indices are pointers into the trees
// currently held by the LayerTreeHost. The number is updated when property // currently held by the LayerTreeHost. The number is updated when property
...@@ -698,6 +712,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -698,6 +712,11 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void SetSubtreePropertyChanged(); void SetSubtreePropertyChanged();
bool subtree_property_changed() const { return subtree_property_changed_; } bool subtree_property_changed() const { return subtree_property_changed_; }
// Internal to property tree construction. Returns ElementListType::ACTIVE
// as main thread layers do not have a pending/active tree split, and
// animations should run normally on the main thread layer tree.
ElementListType GetElementTypeForAnimation() const;
// Internal to property tree construction. Whether this layer may animate its // Internal to property tree construction. Whether this layer may animate its
// opacity on the compositor thread. Layer subclasses may override this to // opacity on the compositor thread. Layer subclasses may override this to
// report true. If true, assumptions about opacity can not be made on the main // report true. If true, assumptions about opacity can not be made on the main
...@@ -735,8 +754,9 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -735,8 +754,9 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
protected: protected:
friend class LayerImpl; friend class LayerImpl;
friend class TreeSynchronizer; friend class TreeSynchronizer;
virtual ~Layer();
Layer(); Layer();
virtual ~Layer();
// These SetNeeds functions are in order of severity of update: // These SetNeeds functions are in order of severity of update:
// //
...@@ -758,11 +778,18 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> { ...@@ -758,11 +778,18 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
// Will recalculate whether the layer draws content and set draws_content_ // Will recalculate whether the layer draws content and set draws_content_
// appropriately. // appropriately.
void UpdateDrawsContent(bool has_drawable_content); void UpdateDrawsContent(bool has_drawable_content);
// May be overridden by subclasses if they have optional content, to return
// false if there is no content to be displayed. If they do have content, then
// they should return the value from this base class method.
virtual bool HasDrawableContent() const; virtual bool HasDrawableContent() const;
// Called when the layer's number of drawable descendants changes. // Called when the layer's number of drawable descendants changes.
void AddDrawableDescendants(int num); void AddDrawableDescendants(int num);
// For debugging. Returns false if the LayerTreeHost this layer is attached to
// is in the process of updating layers for a BeginMainFrame. Layer properties
// should be changed by the client before the BeginMainFrame, and should not
// be changed while the frame is being generated for commit.
bool IsPropertyChangeAllowed() const; bool IsPropertyChangeAllowed() const;
// When true, the layer is about to perform an update. Any commit requests // When true, the layer is about to perform an update. Any commit requests
......
...@@ -74,7 +74,6 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) ...@@ -74,7 +74,6 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
current_draw_mode_(DRAW_MODE_NONE), current_draw_mode_(DRAW_MODE_NONE),
debug_info_(nullptr), debug_info_(nullptr),
has_will_change_transform_hint_(false), has_will_change_transform_hint_(false),
trilinear_filtering_(false),
needs_push_properties_(false), needs_push_properties_(false),
scrollbars_hidden_(false), scrollbars_hidden_(false),
needs_show_scrollbars_(false), needs_show_scrollbars_(false),
...@@ -101,10 +100,6 @@ void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { ...@@ -101,10 +100,6 @@ void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
has_will_change_transform_hint_ = has_will_change; has_will_change_transform_hint_ = has_will_change;
} }
void LayerImpl::SetTrilinearFiltering(bool trilinear_filtering) {
trilinear_filtering_ = trilinear_filtering;
}
ElementListType LayerImpl::GetElementTypeForAnimation() const { ElementListType LayerImpl::GetElementTypeForAnimation() const {
return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING; return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING;
} }
...@@ -325,7 +320,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) { ...@@ -325,7 +320,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->clip_tree_index_ = clip_tree_index_; layer->clip_tree_index_ = clip_tree_index_;
layer->scroll_tree_index_ = scroll_tree_index_; layer->scroll_tree_index_ = scroll_tree_index_;
layer->has_will_change_transform_hint_ = has_will_change_transform_hint_; layer->has_will_change_transform_hint_ = has_will_change_transform_hint_;
layer->trilinear_filtering_ = trilinear_filtering_;
layer->scrollbars_hidden_ = scrollbars_hidden_; layer->scrollbars_hidden_ = scrollbars_hidden_;
if (needs_show_scrollbars_) if (needs_show_scrollbars_)
layer->needs_show_scrollbars_ = needs_show_scrollbars_; layer->needs_show_scrollbars_ = needs_show_scrollbars_;
...@@ -761,8 +755,6 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { ...@@ -761,8 +755,6 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
state->SetBoolean("has_will_change_transform_hint", state->SetBoolean("has_will_change_transform_hint",
has_will_change_transform_hint()); has_will_change_transform_hint());
state->SetBoolean("trilinear_filtering", trilinear_filtering());
MainThreadScrollingReason::AddToTracedValue(main_thread_scrolling_reasons_, MainThreadScrollingReason::AddToTracedValue(main_thread_scrolling_reasons_,
*state); *state);
......
...@@ -430,9 +430,6 @@ class CC_EXPORT LayerImpl { ...@@ -430,9 +430,6 @@ class CC_EXPORT LayerImpl {
return has_will_change_transform_hint_; return has_will_change_transform_hint_;
} }
void SetTrilinearFiltering(bool trilinear_filtering);
bool trilinear_filtering() const { return trilinear_filtering_; }
ElementListType GetElementTypeForAnimation() const; ElementListType GetElementTypeForAnimation() const;
void set_needs_show_scrollbars(bool yes) { needs_show_scrollbars_ = yes; } void set_needs_show_scrollbars(bool yes) { needs_show_scrollbars_ = yes; }
...@@ -567,7 +564,6 @@ class CC_EXPORT LayerImpl { ...@@ -567,7 +564,6 @@ class CC_EXPORT LayerImpl {
base::trace_event::TracedValue* debug_info_; base::trace_event::TracedValue* debug_info_;
bool has_will_change_transform_hint_ : 1; bool has_will_change_transform_hint_ : 1;
bool trilinear_filtering_ : 1;
bool needs_push_properties_ : 1; bool needs_push_properties_ : 1;
bool scrollbars_hidden_ : 1; bool scrollbars_hidden_ : 1;
......
...@@ -337,6 +337,22 @@ TEST_F(LayerTest, LayerPropertyChangedForSubtree) { ...@@ -337,6 +337,22 @@ TEST_F(LayerTest, LayerPropertyChangedForSubtree) {
child2->PushPropertiesTo(child2_impl.get()); child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get())); grand_child->PushPropertiesTo(grand_child_impl.get()));
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTrilinearFiltering(true));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
root->PushPropertiesTo(root_impl.get());
child->PushPropertiesTo(child_impl.get());
child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get()));
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTrilinearFiltering(false));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
root->PushPropertiesTo(root_impl.get());
child->PushPropertiesTo(child_impl.get());
child2->PushPropertiesTo(child2_impl.get());
grand_child->PushPropertiesTo(grand_child_impl.get()));
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetDoubleSided(false)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetDoubleSided(false));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET( EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
......
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