Index: cc/surfaces/display.cc |
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc |
index b9929ba370c505379597580d50c4b74506fc669a..df64a6c908cb60ef785802ca3ca61ea73f17e647 100644 |
--- a/cc/surfaces/display.cc |
+++ b/cc/surfaces/display.cc |
@@ -14,6 +14,7 @@ |
#include "cc/surfaces/display_client.h" |
#include "cc/surfaces/surface.h" |
#include "cc/surfaces/surface_aggregator.h" |
+#include "cc/surfaces/surface_manager.h" |
namespace cc { |
@@ -21,14 +22,17 @@ Display::Display(DisplayClient* client, |
SurfaceManager* manager, |
SharedBitmapManager* bitmap_manager) |
: client_(client), manager_(manager), bitmap_manager_(bitmap_manager) { |
+ manager_->AddObserver(this); |
} |
Display::~Display() { |
+ manager_->RemoveObserver(this); |
} |
void Display::Resize(SurfaceId id, const gfx::Size& size) { |
current_surface_id_ = id; |
current_surface_size_ = size; |
+ client_->DisplayDamaged(); |
} |
void Display::InitializeOutputSurface() { |
@@ -85,8 +89,10 @@ bool Display::Draw() { |
if (!output_surface_) |
return false; |
+ contained_surfaces_.clear(); |
+ |
scoped_ptr<CompositorFrame> frame = |
- aggregator_->Aggregate(current_surface_id_); |
+ aggregator_->Aggregate(current_surface_id_, &contained_surfaces_); |
if (!frame) |
return false; |
@@ -113,6 +119,11 @@ bool Display::Draw() { |
return true; |
} |
+void Display::OnSurfaceDamaged(SurfaceId surface) { |
+ if (contained_surfaces_.find(surface) != contained_surfaces_.end()) |
+ client_->DisplayDamaged(); |
+} |
+ |
SurfaceId Display::CurrentSurfaceId() { |
return current_surface_id_; |
} |