Commit 47fcf3ca authored by danakj's avatar danakj Committed by Commit Bot

cc: Documenting Layer APIs for transform offset, telemetry, tracing.

And remove an empty method and the caller on MicroBenchmark.

R=weiliangc@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I9750cbcf1daebf365f8e5bd91022dedf32e49ec4
Reviewed-on: https://chromium-review.googlesource.com/1103137
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568482}
parent 62214d92
......@@ -34,8 +34,6 @@ void MicroBenchmark::NotifyDone(std::unique_ptr<base::Value> result) {
is_done_ = true;
}
void MicroBenchmark::RunOnLayer(Layer* layer) {}
void MicroBenchmark::RunOnLayer(PictureLayer* layer) {}
bool MicroBenchmark::ProcessMessage(std::unique_ptr<base::Value> value) {
......
......@@ -16,11 +16,10 @@ class Value;
} // namespace base
namespace cc {
class Layer;
class LayerTreeHost;
class PictureLayer;
class MicroBenchmarkImpl;
class CC_EXPORT MicroBenchmark {
public:
using DoneCallback = base::OnceCallback<void(std::unique_ptr<base::Value>)>;
......@@ -33,7 +32,6 @@ class CC_EXPORT MicroBenchmark {
int id() const { return id_; }
void set_id(int id) { id_ = id; }
virtual void RunOnLayer(Layer* layer);
virtual void RunOnLayer(PictureLayer* layer);
virtual bool ProcessMessage(std::unique_ptr<base::Value> value);
......
......@@ -1394,9 +1394,7 @@ void Layer::AddDrawableDescendants(int num) {
parent()->AddDrawableDescendants(num);
}
void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
benchmark->RunOnLayer(this);
}
void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {}
void Layer::SetElementId(ElementId id) {
DCHECK(IsPropertyChangeAllowed());
......
......@@ -82,8 +82,15 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
SINGLE_TEXTURE_MASK,
};
// Factory to create a new Layer, with a unique id.
static scoped_refptr<Layer> Create();
// Sets an optional client on this layer, that will be called when relevant
// events happen. The client is a WeakPtr so it can be destroyed without
// unsetting itself as the client.
void SetLayerClient(base::WeakPtr<LayerClient> client);
LayerClient* GetLayerClientForTesting() const { return inputs_.client.get(); }
// A unique and stable id for the Layer. Ids are always positive.
int id() const { return inputs_.layer_id; }
......@@ -540,13 +547,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void UpdateDebugInfo();
void SetLayerClient(base::WeakPtr<LayerClient> client);
LayerClient* GetLayerClientForTesting() const { return inputs_.client.get(); }
virtual sk_sp<SkPicture> GetPicture() const;
virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
// 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
// remain valid and in in the same state until the next main frame, or until
......@@ -562,11 +562,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void SetHasTransformNode(bool val) { has_transform_node_ = val; }
bool has_transform_node() { return has_transform_node_; }
void SetOffsetToTransformParent(gfx::Vector2dF offset);
gfx::Vector2dF offset_to_transform_parent() const {
return offset_to_transform_parent_;
}
void SetMayContainVideo(bool yes);
// Stable identifier for clients. See comment in cc/trees/element_id.h.
......@@ -594,6 +589,19 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
// Called on the scroll layer to trigger showing the overlay scrollbars.
void ShowScrollbars() { needs_show_scrollbars_ = true; }
// For tracing. Gets a recorded rasterization of this layer's contents that
// can be displayed inside representations of this layer. May return null, in
// which case the layer won't be shown with any content in the tracing
// display.
virtual sk_sp<SkPicture> GetPicture() const;
// For telemetry testing. Runs a given test behaviour implemented in
// |benchmark| for this layer. The base class does nothing as benchmarks
// only exist for subclass layer types. For each subclass that the
// MicroBenchmark supports, the class should override this method and run the
// |benchmark| against this layer.
virtual void RunMicroBenchmark(MicroBenchmark* benchmark);
// Internal method to create the compositor thread type for this Layer.
// Subclasses should override this method if they want to return their own
// subclass of LayerImpl instead.
......@@ -674,6 +682,15 @@ class CC_EXPORT Layer : public base::RefCounted<Layer> {
void SetEffectTreeIndex(int index);
void SetScrollTreeIndex(int index);
// Internal to property tree construction. Set or get the position of this
// layer relative to the origin after transforming according to this layer's
// index into the transform tree. This translation is appended to the
// transform that comes from the transform tree for this layer.
void SetOffsetToTransformParent(gfx::Vector2dF offset);
gfx::Vector2dF offset_to_transform_parent() const {
return offset_to_transform_parent_;
}
// Internal to property tree construction. Indicates that a property changed
// on this layer that may affect the position or content of all layers in this
// layer's subtree, including itself. This causes the layer's subtree to be
......
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