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

Unified Diff: sky/sdk/lib/framework/app.dart

Issue 1178703002: Abstract out the AppView logic in fn so that it can also be used in non-pure-fn apps. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | « sky/examples/stocks2/lib/stock_app.dart ('k') | sky/sdk/lib/framework/fn2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/app.dart
diff --git a/sky/sdk/lib/framework/app.dart b/sky/sdk/lib/framework/app.dart
index 0e3787b7e1cc58befe022213f92cca712912cc06..7785088e6970708ec7fb55c78fe63a25710012fd 100644
--- a/sky/sdk/lib/framework/app.dart
+++ b/sky/sdk/lib/framework/app.dart
@@ -16,7 +16,10 @@ class PointerState {
class AppView {
- AppView(RenderBox root) {
+ AppView([RenderBox root = null]) {
+ assert(_app == null);
+ _app = this;
+
sky.view.setEventCallback(_handleEvent);
sky.view.setMetricsChangedCallback(_handleMetricsChanged);
scheduler.init();
@@ -26,8 +29,12 @@ class AppView {
_renderView.attach();
_renderView.rootConstraints = _viewConstraints;
_renderView.scheduleInitialLayout();
+
+ assert(_app == this);
}
+ static AppView _app; // used to enforce that we're a singleton
+
RenderView _renderView;
ViewConstraints get _viewConstraints =>
« no previous file with comments | « sky/examples/stocks2/lib/stock_app.dart ('k') | sky/sdk/lib/framework/fn2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698