Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: cc/surfaces/display.cc

Issue 432093003: Enqueuing new frames in a Surface should cause Displays to reaggregate it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/display.cc
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index b9929ba370c505379597580d50c4b74506fc669a..68f521f1ef0be9091e8e8fffd94260b12a3d3031 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -20,15 +20,22 @@ namespace cc {
Display::Display(DisplayClient* client,
SurfaceManager* manager,
SharedBitmapManager* bitmap_manager)
- : client_(client), manager_(manager), bitmap_manager_(bitmap_manager) {
+ : client_(client),
+ manager_(manager),
+ bitmap_manager_(bitmap_manager),
+ scheduled_draw_(false),
+ weak_ptr_factory_(this) {
}
Display::~Display() {
+ ClearSurfaceList();
}
void Display::Resize(SurfaceId id, const gfx::Size& size) {
current_surface_id_ = id;
current_surface_size_ = size;
+ ClearSurfaceList();
+ Draw();
}
void Display::InitializeOutputSurface() {
@@ -78,19 +85,36 @@ void Display::InitializeOutputSurface() {
}
bool Display::Draw() {
+ if (scheduled_draw_)
+ return true;
+ scheduled_draw_ = true;
+ base::MessageLoopProxy::current()->PostTask(
jamesr 2014/08/07 21:04:06 the Display should not self-schedule. tell the cli
piman 2014/08/07 21:09:32 drive-by: also going to MessageLoopProxy::current(
+ FROM_HERE, base::Bind(&Display::DoDraw, weak_ptr_factory_.GetWeakPtr()));
+ return true;
+}
+
+void Display::DoDraw() {
+ TRACE_EVENT0("cc", "Display::DoDraw");
+ scheduled_draw_ = false;
if (current_surface_id_.is_null())
- return false;
+ return;
InitializeOutputSurface();
if (!output_surface_)
- return false;
+ return;
+ ClearSurfaceList();
scoped_ptr<CompositorFrame> frame =
- aggregator_->Aggregate(current_surface_id_);
+ aggregator_->Aggregate(current_surface_id_, &contained_surfaces_);
+
+ for (std::set<Surface*>::iterator it = contained_surfaces_.begin();
+ it != contained_surfaces_.end();
+ ++it) {
+ (*it)->containing_displays().insert(this);
+ }
if (!frame)
- return false;
+ return;
- TRACE_EVENT0("cc", "Display::Draw");
DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
// Only reshape when we know we are going to draw. Otherwise, the reshape
@@ -110,7 +134,16 @@ bool Display::Draw() {
disable_picture_quad_image_filtering);
CompositorFrameMetadata metadata;
renderer_->SwapBuffers(metadata);
- return true;
+}
+
+void Display::ClearSurfaceList() {
+ for (std::set<Surface*>::iterator it = contained_surfaces_.begin();
+ it != contained_surfaces_.end();
+ ++it) {
+ (*it)->containing_displays().erase(this);
+ }
+
+ contained_surfaces_.clear();
}
SurfaceId Display::CurrentSurfaceId() {

Powered by Google App Engine
This is Rietveld 408576698