| Index: ui/compositor/layer.cc
|
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
|
| index c7111526207124f5ba5b647301a49742c2bc4ea9..5cf93d099cc5f2b60ffa8c116cdedce3201a26a2 100644
|
| --- a/ui/compositor/layer.cc
|
| +++ b/ui/compositor/layer.cc
|
| @@ -28,6 +28,7 @@
|
| #include "ui/compositor/compositor_switches.h"
|
| #include "ui/compositor/dip_util.h"
|
| #include "ui/compositor/layer_animator.h"
|
| +#include "ui/compositor/layer_observer.h"
|
| #include "ui/compositor/paint_context.h"
|
| #include "ui/gfx/animation/animation.h"
|
| #include "ui/gfx/canvas.h"
|
| @@ -95,6 +96,8 @@ Layer::Layer(LayerType type)
|
| }
|
|
|
| Layer::~Layer() {
|
| + FOR_EACH_OBSERVER(LayerObserver, observer_list_, LayerDestroyed(this));
|
| +
|
| // Destroying the animator may cause observers to use the layer (and
|
| // indirectly the WebLayer). Destroy the animator first so that the WebLayer
|
| // is still around.
|
| @@ -147,6 +150,14 @@ void Layer::ResetCompositor() {
|
| }
|
| }
|
|
|
| +void Layer::AddObserver(LayerObserver* observer) {
|
| + observer_list_.AddObserver(observer);
|
| +}
|
| +
|
| +void Layer::RemoveObserver(LayerObserver* observer) {
|
| + observer_list_.RemoveObserver(observer);
|
| +}
|
| +
|
| void Layer::Add(Layer* child) {
|
| DCHECK(!child->compositor_);
|
| if (child->parent_)
|
| @@ -584,6 +595,8 @@ void Layer::SetShowSurface(
|
|
|
| frame_size_in_dip_ = frame_size_in_dip;
|
| RecomputeDrawsContentAndUVRect();
|
| +
|
| + FOR_EACH_OBSERVER(LayerObserver, observer_list_, SurfaceChanged(this));
|
| }
|
|
|
| void Layer::SetShowSolidColorContent() {
|
| @@ -729,9 +742,8 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
|
|
|
| void Layer::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
|
| DCHECK(surface_layer_.get());
|
| - if (!delegate_)
|
| - return;
|
| - delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
|
| + if (delegate_)
|
| + delegate_->OnDelegatedFrameDamage(damage_rect_in_dip);
|
| }
|
|
|
| void Layer::SetScrollable(Layer* parent_clip_layer,
|
| @@ -787,6 +799,8 @@ scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
|
| PaintContext(display_list.get(), device_scale_factor_, invalidation));
|
| }
|
| display_list->Finalize();
|
| + FOR_EACH_OBSERVER(LayerObserver, observer_list_,
|
| + DidPaintLayer(this, invalidation));
|
| return display_list;
|
| }
|
|
|
|
|