Commit 6dc440bd authored by Ian Hickson's avatar Ian Hickson

Make rootBundle handle the no-mojo case. (#3408)

The defaulting logic for bundles really belongs in the services layer,
not the widgets layer. This way we can tell non-widget code just to use
rootBundle if it just wants to read a JSON file or some such.
parent 6f0bb206
...@@ -106,7 +106,7 @@ class MojoAssetBundle extends CachingAssetBundle { ...@@ -106,7 +106,7 @@ class MojoAssetBundle extends CachingAssetBundle {
AssetBundle _initRootBundle() { AssetBundle _initRootBundle() {
int h = ui.MojoServices.takeRootBundle(); int h = ui.MojoServices.takeRootBundle();
if (h == core.MojoHandle.INVALID) if (h == core.MojoHandle.INVALID)
return null; return new NetworkAssetBundle(Uri.base);
core.MojoHandle handle = new core.MojoHandle(h); core.MojoHandle handle = new core.MojoHandle(h);
return new MojoAssetBundle(new AssetBundleProxy.fromHandle(handle)); return new MojoAssetBundle(new AssetBundleProxy.fromHandle(handle));
} }
......
...@@ -20,14 +20,6 @@ import 'performance_overlay.dart'; ...@@ -20,14 +20,6 @@ import 'performance_overlay.dart';
import 'semantics_debugger.dart'; import 'semantics_debugger.dart';
import 'title.dart'; import 'title.dart';
AssetBundle _initDefaultBundle() {
if (rootBundle != null)
return rootBundle;
return new NetworkAssetBundle(Uri.base);
}
final AssetBundle _defaultBundle = _initDefaultBundle();
typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale); typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
/// A convenience class that wraps a number of widgets that are commonly /// A convenience class that wraps a number of widgets that are commonly
...@@ -173,7 +165,7 @@ class WidgetsAppState<T extends WidgetsApp> extends State<T> implements BindingO ...@@ -173,7 +165,7 @@ class WidgetsAppState<T extends WidgetsApp> extends State<T> implements BindingO
child: new LocaleQuery( child: new LocaleQuery(
data: _localeData, data: _localeData,
child: new AssetVendor( child: new AssetVendor(
bundle: _defaultBundle, bundle: rootBundle,
devicePixelRatio: ui.window.devicePixelRatio, devicePixelRatio: ui.window.devicePixelRatio,
child: new Title( child: new Title(
title: config.title, title: config.title,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment