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

Unified Diff: examples/surfaces_app/embedder.cc

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « examples/surfaces_app/embedder.h ('k') | examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/surfaces_app/embedder.cc
diff --git a/examples/surfaces_app/embedder.cc b/examples/surfaces_app/embedder.cc
index 872c91b99447e88c8ab1181cca159111ec2cf07d..964a3bc212459c3ac5634717faae32fc6a19b068 100644
--- a/examples/surfaces_app/embedder.cc
+++ b/examples/surfaces_app/embedder.cc
@@ -27,8 +27,8 @@ using cc::SolidColorDrawQuad;
using cc::DelegatedFrameData;
using cc::CompositorFrame;
-Embedder::Embedder(uint32_t local_id, Surface* surface)
- : local_id_(local_id), surface_(surface) {
+Embedder::Embedder(Display* display)
+ : display_(display), frame_pending_(false) {
}
Embedder::~Embedder() {
@@ -39,6 +39,8 @@ void Embedder::ProduceFrame(cc::SurfaceId child_one,
const gfx::Size& child_size,
const gfx::Size& size,
int offset) {
+ DCHECK(!frame_pending_);
+
gfx::Rect rect(size);
RenderPassId pass_id(1, 1);
scoped_ptr<RenderPass> pass = RenderPass::Create();
@@ -90,7 +92,9 @@ void Embedder::ProduceFrame(cc::SurfaceId child_one,
scoped_ptr<CompositorFrame> frame(new CompositorFrame);
frame->delegated_frame_data = delegated_frame_data.Pass();
- surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure());
+ frame_pending_ = true;
+ display_->SubmitFrame(mojo::Frame::From(*frame),
+ [this]() { frame_pending_ = false; });
}
} // namespace examples
« no previous file with comments | « examples/surfaces_app/embedder.h ('k') | examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698