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

Side by Side Diff: dart/sdk/lib/_internal/lib/async_patch.dart

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Patch file for the dart:async library. 5 // Patch file for the dart:async library.
6 6
7 import 'dart:_js_helper' show Primitives; 7 import 'dart:_js_helper' show Primitives;
8 import 'dart:_isolate_helper' show IsolateNatives, TimerImpl; 8 import 'dart:_isolate_helper' show IsolateNatives, TimerImpl;
9 import 'dart:_foreign_helper' show JS, DART_CLOSURE_TO_JS; 9 import 'dart:_foreign_helper' show JS, DART_CLOSURE_TO_JS;
10 10
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 } 29 }
30 30
31 patch class DeferredLibrary { 31 patch class DeferredLibrary {
32 patch Future<bool> load() { 32 patch Future<bool> load() {
33 return _load(libraryName, uri); 33 return _load(libraryName, uri);
34 } 34 }
35 } 35 }
36 36
37 // TODO(ahe): This should not only apply to this isolate. 37 // TODO(ahe): This should not only apply to this isolate.
38 final _loadedLibraries = <String, Completer<bool>>{}; 38 final Map<String, Future<bool>> _loadedLibraries = <String, Future<bool>>{};
39 39
40 Future<bool> _load(String libraryName, String uri) { 40 Future<bool> _load(String libraryName, String uri) {
41 // TODO(ahe): Validate libraryName. Kasper points out that you want 41 // TODO(ahe): Validate libraryName. Kasper points out that you want
42 // to be able to experiment with the effect of toggling @DeferLoad, 42 // to be able to experiment with the effect of toggling @DeferLoad,
43 // so perhaps we should silently ignore "bad" library names. 43 // so perhaps we should silently ignore "bad" library names.
44 Future<bool> future = _loadedLibraries[libraryName]; 44 Future<bool> future = _loadedLibraries[libraryName];
45 if (future != null) { 45 if (future != null) {
46 return future.then((_) => false); 46 return future.then((_) => false);
47 } 47 }
48 48
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 }); 93 });
94 } 94 }
95 95
96 /// Used to implement deferred loading. Used as callback on "load" 96 /// Used to implement deferred loading. Used as callback on "load"
97 /// event above in [load]. 97 /// event above in [load].
98 _onDeferredLibraryLoad(Completer<bool> completer, event) { 98 _onDeferredLibraryLoad(Completer<bool> completer, event) {
99 completer.complete(true); 99 completer.complete(true);
100 } 100 }
101 101
102 bool get _hasDocument => JS('String', 'typeof document') == 'object'; 102 bool get _hasDocument => JS('String', 'typeof document') == 'object';
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | dart/sdk/lib/_internal/lib/isolate_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698