| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.js_emitter.startup_emitter.model_emitter; | 5 library dart2js.js_emitter.startup_emitter.model_emitter; |
| 6 | 6 |
| 7 import 'dart:convert' show JsonEncoder; | 7 import 'dart:convert' show JsonEncoder; |
| 8 | 8 |
| 9 import '../../common.dart'; | 9 import '../../common.dart'; |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 import '../../io/source_map_builder.dart' show | 22 import '../../io/source_map_builder.dart' show |
| 23 SourceMapBuilder; | 23 SourceMapBuilder; |
| 24 | 24 |
| 25 import '../../js/js.dart' as js; | 25 import '../../js/js.dart' as js; |
| 26 import '../../js_backend/js_backend.dart' show | 26 import '../../js_backend/js_backend.dart' show |
| 27 JavaScriptBackend, | 27 JavaScriptBackend, |
| 28 Namer, | 28 Namer, |
| 29 ConstantEmitter; | 29 ConstantEmitter; |
| 30 | 30 |
| 31 import '../../messages.dart' show MessageKind; | |
| 32 | |
| 33 import '../../util/util.dart' show | 31 import '../../util/util.dart' show |
| 34 NO_LOCATION_SPANNABLE; | 32 NO_LOCATION_SPANNABLE; |
| 35 | 33 |
| 36 import '../../util/uri_extras.dart' show | 34 import '../../util/uri_extras.dart' show |
| 37 relativize; | 35 relativize; |
| 38 | 36 |
| 39 import '../headers.dart'; | 37 import '../headers.dart'; |
| 40 import '../js_emitter.dart' show AstContainer, NativeEmitter; | 38 import '../js_emitter.dart' show AstContainer, NativeEmitter; |
| 41 | 39 |
| 42 import 'package:js_runtime/shared/embedded_names.dart' show | 40 import 'package:js_runtime/shared/embedded_names.dart' show |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 writeMainFragment(mainFragment, mainCode); | 206 writeMainFragment(mainFragment, mainCode); |
| 209 | 207 |
| 210 if (backend.requiresPreamble && | 208 if (backend.requiresPreamble && |
| 211 !backend.htmlLibraryIsLoaded) { | 209 !backend.htmlLibraryIsLoaded) { |
| 212 compiler.reportHint(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); | 210 compiler.reportHint(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); |
| 213 } | 211 } |
| 214 | 212 |
| 215 if (compiler.deferredMapUri != null) { | 213 if (compiler.deferredMapUri != null) { |
| 216 writeDeferredMap(); | 214 writeDeferredMap(); |
| 217 } | 215 } |
| 218 | 216 |
| 219 // Return the total program size. | 217 // Return the total program size. |
| 220 return outputBuffers.values.fold(0, (a, b) => a + b.length); | 218 return outputBuffers.values.fold(0, (a, b) => a + b.length); |
| 221 } | 219 } |
| 222 | 220 |
| 223 /// Generates a simple header that provides the compiler's build id. | 221 /// Generates a simple header that provides the compiler's build id. |
| 224 js.Comment buildGeneratedBy() { | 222 js.Comment buildGeneratedBy() { |
| 225 String flavor = compiler.useContentSecurityPolicy | 223 String flavor = compiler.useContentSecurityPolicy |
| 226 ? 'fast startup, CSP' | 224 ? 'fast startup, CSP' |
| 227 : 'fast startup'; | 225 : 'fast startup'; |
| 228 return new js.Comment(generatedBy(compiler, flavor: flavor)); | 226 return new js.Comment(generatedBy(compiler, flavor: flavor)); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // Json does not support comments, so we embed the explanation in the | 397 // Json does not support comments, so we embed the explanation in the |
| 400 // data. | 398 // data. |
| 401 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 399 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
| 402 "needed for a given deferred library import."; | 400 "needed for a given deferred library import."; |
| 403 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 401 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
| 404 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map') | 402 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map') |
| 405 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 403 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
| 406 ..close(); | 404 ..close(); |
| 407 } | 405 } |
| 408 } | 406 } |
| OLD | NEW |