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

Unified Diff: examples/ui/noodles/rasterizer.h

Issue 1558813002: Add a multi-threaded rendering example. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-15
Patch Set: Created 4 years, 12 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: examples/ui/noodles/rasterizer.h
diff --git a/examples/ui/noodles/rasterizer.h b/examples/ui/noodles/rasterizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..040c98564638aa222dd95fa3f61180c2306651f3
--- /dev/null
+++ b/examples/ui/noodles/rasterizer.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXAMPLES_UI_NOODLES_RASTERIZER_H_
+#define EXAMPLES_UI_NOODLES_RASTERIZER_H_
+
+#include <memory>
+
+#include "mojo/gpu/gl_context.h"
+#include "mojo/gpu/gl_context_owner.h"
+#include "mojo/public/interfaces/application/application_connector.mojom.h"
+#include "mojo/services/gfx/composition/interfaces/scenes.mojom.h"
+#include "mojo/skia/ganesh_context.h"
+#include "mojo/ui/ganesh_renderer.h"
+
+namespace examples {
+
+class Frame;
+
+// Ganesh-based rasterizer which runs on a separate thread from the view.
+// Calls into this object, including its creation, must be posted to the
+// correct message loop by the view.
+class Rasterizer {
+ public:
+ Rasterizer(mojo::ApplicationConnectorPtr connector,
+ mojo::gfx::composition::ScenePtr scene);
+
+ ~Rasterizer();
+
+ void PublishFrame(std::unique_ptr<Frame> frame);
+
+ private:
+ mojo::GLContextOwner gl_context_owner_;
+ mojo::skia::GaneshContext ganesh_context_;
+ mojo::ui::GaneshRenderer ganesh_renderer_;
+ mojo::gfx::composition::ScenePtr scene_;
+
+ DISALLOW_COPY_AND_ASSIGN(Rasterizer);
+};
+
+} // namespace examples
+
+#endif // EXAMPLES_UI_NOODLES_RASTERIZER_H_

Powered by Google App Engine
This is Rietveld 408576698