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

Side by Side Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 2000323006: Make CompilerTask independent of compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
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 library leg_apiimpl; 5 library leg_apiimpl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:package_config/packages.dart'; 10 import 'package:package_config/packages.dart';
(...skipping 13 matching lines...) Expand all
24 import 'io/source_file.dart'; 24 import 'io/source_file.dart';
25 import 'options.dart' show CompilerOptions; 25 import 'options.dart' show CompilerOptions;
26 import 'platform_configuration.dart' as platform_configuration; 26 import 'platform_configuration.dart' as platform_configuration;
27 import 'resolved_uri_translator.dart'; 27 import 'resolved_uri_translator.dart';
28 import 'script.dart'; 28 import 'script.dart';
29 import 'serialization/system.dart'; 29 import 'serialization/system.dart';
30 30
31 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the 31 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the
32 /// sources. 32 /// sources.
33 class CompilerImpl extends Compiler { 33 class CompilerImpl extends Compiler {
34 final Measurer measurer;
34 api.CompilerInput provider; 35 api.CompilerInput provider;
35 api.CompilerDiagnostics handler; 36 api.CompilerDiagnostics handler;
36 Packages packages; 37 Packages packages;
37 38
38 bool get mockableLibraryUsed => resolvedUriTranslator.isSet 39 bool get mockableLibraryUsed => resolvedUriTranslator.isSet
39 ? resolvedUriTranslator.mockableLibraryUsed 40 ? resolvedUriTranslator.mockableLibraryUsed
40 : false; 41 : false;
41 42
42 ForwardingResolvedUriTranslator resolvedUriTranslator; 43 ForwardingResolvedUriTranslator resolvedUriTranslator;
43 44
44 GenericTask userHandlerTask; 45 GenericTask userHandlerTask;
45 GenericTask userProviderTask; 46 GenericTask userProviderTask;
46 GenericTask userPackagesDiscoveryTask; 47 GenericTask userPackagesDiscoveryTask;
47 48
48 Uri get libraryRoot => options.platformConfigUri.resolve("."); 49 Uri get libraryRoot => options.platformConfigUri.resolve(".");
49 50
50 CompilerImpl(this.provider, api.CompilerOutput outputProvider, this.handler, 51 CompilerImpl(this.provider, api.CompilerOutput outputProvider, this.handler,
51 CompilerOptions options, 52 CompilerOptions options,
52 {MakeBackendFuncion makeBackend, MakeReporterFunction makeReporter}) 53 {MakeBackendFuncion makeBackend, MakeReporterFunction makeReporter})
53 : resolvedUriTranslator = new ForwardingResolvedUriTranslator(), 54 // NOTE: allocating measurer is done upfront to ensure the wallclock is
55 // started before other computations.
56 : measurer = new Measurer(enableTaskMeasurements: options.verbose),
57 resolvedUriTranslator = new ForwardingResolvedUriTranslator(),
54 super( 58 super(
55 options: options, 59 options: options,
56 outputProvider: outputProvider, 60 outputProvider: outputProvider,
57 environment: new _Environment(options.environment), 61 environment: new _Environment(options.environment),
58 makeBackend: makeBackend, 62 makeBackend: makeBackend,
59 makeReporter: makeReporter) { 63 makeReporter: makeReporter) {
60 _Environment env = environment; 64 _Environment env = environment;
61 env.compiler = this; 65 env.compiler = this;
62 tasks.addAll([ 66 tasks.addAll([
63 userHandlerTask = new GenericTask('Diagnostic handler', this), 67 userHandlerTask = new GenericTask('Diagnostic handler', measurer),
64 userProviderTask = new GenericTask('Input provider', this), 68 userProviderTask = new GenericTask('Input provider', measurer),
65 userPackagesDiscoveryTask = new GenericTask('Package discovery', this), 69 userPackagesDiscoveryTask =
70 new GenericTask('Package discovery', measurer),
66 ]); 71 ]);
67 } 72 }
68 73
69 void log(message) { 74 void log(message) {
70 callUserHandler( 75 callUserHandler(
71 null, null, null, null, message, api.Diagnostic.VERBOSE_INFO); 76 null, null, null, null, message, api.Diagnostic.VERBOSE_INFO);
72 } 77 }
73 78
74 /** 79 /**
75 * Reads the script designated by [readableUri]. 80 * Reads the script designated by [readableUri].
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 395 }
391 } 396 }
392 397
393 /// For every 'dart:' library, a corresponding environment variable is set 398 /// For every 'dart:' library, a corresponding environment variable is set
394 /// to "true". The environment variable's name is the concatenation of 399 /// to "true". The environment variable's name is the concatenation of
395 /// this prefix and the name (without the 'dart:'. 400 /// this prefix and the name (without the 'dart:'.
396 /// 401 ///
397 /// For example 'dart:html' has the environment variable 'dart.library.html' set 402 /// For example 'dart:html' has the environment variable 'dart.library.html' set
398 /// to "true". 403 /// to "true".
399 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; 404 const String _dartLibraryEnvironmentPrefix = 'dart.library.';
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/closure.dart » ('j') | pkg/compiler/lib/src/common/tasks.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698