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

Unified Diff: services/surfaces/display_impl.cc

Issue 1116883002: Automatically redraw the display on resume. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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: services/surfaces/display_impl.cc
diff --git a/services/surfaces/display_impl.cc b/services/surfaces/display_impl.cc
index 217ebc5d70488fbcc7bf83cf55ad86e2b790b836..4d99b5c6f459670e7d6f186c3e75ef6404410e83 100644
--- a/services/surfaces/display_impl.cc
+++ b/services/surfaces/display_impl.cc
@@ -4,6 +4,7 @@
#include "services/surfaces/display_impl.h"
+#include "base/bind.h"
#include "cc/output/compositor_frame.h"
#include "cc/surfaces/display.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
@@ -33,6 +34,9 @@ DisplayImpl::DisplayImpl(cc::SurfaceManager* manager,
returner_(returner.Pass()),
viewport_param_binding_(this),
display_binding_(this, display_request.Pass()) {
+ context_provider_->NotifyOnViewportCreated(
+ base::Bind(&DisplayImpl::OnViewportCreated, base::Unretained(this)));
+
mojo::ViewportParameterListenerPtr viewport_parameter_listener;
viewport_param_binding_.Bind(GetProxy(&viewport_parameter_listener));
context_provider_->Create(
@@ -77,14 +81,21 @@ void DisplayImpl::Draw() {
pending_frame_->passes[0]->output_rect.To<gfx::Rect>().size();
last_submitted_frame_size_ = frame_size;
display_->Resize(frame_size);
- factory_.SubmitFrame(cc_id_,
- pending_frame_.To<scoped_ptr<cc::CompositorFrame>>(),
- base::Bind(&CallCallback, pending_callback_));
+ factory_.SubmitFrame(
+ cc_id_, pending_frame_.Clone().To<scoped_ptr<cc::CompositorFrame>>(),
+ base::Bind(&CallCallback, pending_callback_));
scheduler_->SetNeedsDraw();
- pending_frame_.reset();
pending_callback_.reset();
}
+void DisplayImpl::OnViewportCreated() {
+ if (display_ && pending_frame_) {
+ Draw();
+ }
+ context_provider_->NotifyOnViewportCreated(
+ base::Bind(&DisplayImpl::OnViewportCreated, base::Unretained(this)));
+}
+
void DisplayImpl::DisplayDamaged() {
}

Powered by Google App Engine
This is Rietveld 408576698