Chromium Code Reviews| Index: runtime/bin/builtin.dart |
| diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart |
| index 2dbc3e79eb8a03e46ea740b674026c4902bbd593..f6bbdabf2fc511fee7012caf0f7c02fc3d89c398 100644 |
| --- a/runtime/bin/builtin.dart |
| +++ b/runtime/bin/builtin.dart |
| @@ -27,14 +27,7 @@ class _Logger { |
| _getPrintClosure() => _print; |
| - |
| -void _logResolution(String msg) { |
| - final enabled = false; |
| - if (enabled) { |
| - _Logger._printString(msg); |
| - } |
| -} |
| - |
| +final _logBuiltin = false; |
|
Ivan Posva
2014/09/04 15:35:25
const?
Anders Johnsen
2014/09/05 05:36:58
Done.
|
| // Corelib 'Uri.base' implementation. |
| Uri _uriBase() { |
| @@ -112,7 +105,7 @@ void _setWorkingDirectory(cwd) { |
| cwd = _sanitizeWindowsPath(cwd); |
| cwd = _enforceTrailingSlash(cwd); |
| _workingDirectoryUri = new Uri(scheme: 'file', path: cwd); |
| - _logResolution('# Working Directory: $cwd'); |
| + if (_logBuiltin) _print('# Working Directory: $cwd'); |
|
Ivan Posva
2014/09/04 15:35:25
{}?
Anders Johnsen
2014/09/05 05:36:58
Done.
|
| } |
| @@ -125,7 +118,7 @@ _setPackageRoot(String packageRoot) { |
| } else { |
| _packageRoot = _workingDirectoryUri.resolveUri(new Uri.file(packageRoot)); |
| } |
| - _logResolution('# Package root: $packageRoot -> $_packageRoot'); |
| + if (_logBuiltin) _print('# Package root: $packageRoot -> $_packageRoot'); |
| } |
| @@ -144,14 +137,14 @@ String _resolveScriptUri(String scriptName) { |
| // resolve it against the working directory. |
| _entryPointScript = _workingDirectoryUri.resolve(scriptName); |
| } |
| - _logResolution('# Resolved entry point to: $_entryPointScript'); |
| + if (_logBuiltin) _print('# Resolved entry point to: $_entryPointScript'); |
| return _entryPointScript.toString(); |
| } |
| const _DART_EXT = 'dart-ext:'; |
| String _resolveUri(String base, String userString) { |
| - _logResolution('# Resolving: $userString from $base'); |
| + if (_logBuiltin) _print('# Resolving: $userString from $base'); |
| var baseUri = Uri.parse(base); |
| if (userString.startsWith(_DART_EXT)) { |
| var uri = userString.substring(_DART_EXT.length); |
| @@ -165,7 +158,7 @@ String _resolveUri(String base, String userString) { |
| // Returns either a file path or a URI starting with http:, as a String. |
| String _filePathFromUri(String userUri) { |
| var uri = Uri.parse(userUri); |
| - _logResolution('# Getting file path from: $uri'); |
| + if (_logBuiltin) _print('# Getting file path from: $uri'); |
| var path; |
| switch (uri.scheme) { |
| @@ -181,7 +174,7 @@ String _filePathFromUri(String userUri) { |
| default: |
| // Only handling file, http, and package URIs |
| // in standalone binary. |
| - _logResolution('# Unknown scheme (${uri.scheme}) in $uri.'); |
| + if (_logBuiltin) _print('# Unknown scheme (${uri.scheme}) in $uri.'); |
| throw 'Not a known scheme: $uri'; |
| } |
| } |
| @@ -258,8 +251,10 @@ void _loadScript(int tag, String uri, String libraryUri, List<int> data) { |
| _loadScriptCallback(tag, uri, libraryUri, data); |
| assert(_numOutstandingLoadRequests > 0); |
| _numOutstandingLoadRequests--; |
| - _logResolution("native Builtin_LoadScript($uri) completed, " |
| - "${_numOutstandingLoadRequests} requests remaining"); |
| + if (_logBuiltin) { |
| + _print("native Builtin_LoadScript($uri) completed, " |
| + "${_numOutstandingLoadRequests} requests remaining"); |
| + } |
| if (_numOutstandingLoadRequests == 0) { |
| _signalDoneLoading(); |
| _cleanup(); |
| @@ -272,7 +267,7 @@ void _asyncLoadErrorCallback(uri, libraryUri, error) |
| void _asyncLoadError(uri, libraryUri, error) { |
| assert(_numOutstandingLoadRequests > 0); |
| - _logResolution("_asyncLoadError($uri), error: $error"); |
| + if (_logBuiltin) _print("_asyncLoadError($uri), error: $error"); |
| _numOutstandingLoadRequests--; |
| _asyncLoadErrorCallback(uri, libraryUri, error); |
| if (_numOutstandingLoadRequests == 0) { |
| @@ -295,8 +290,10 @@ _loadDataAsync(int tag, String uri, String libraryUri) { |
| sourceUri = Uri.parse(filePath); |
| } |
| _numOutstandingLoadRequests++; |
| - _logResolution("_loadDataAsync($uri), " |
| - "${_numOutstandingLoadRequests} requests outstanding"); |
| + if (_logBuiltin) { |
| + _print("_loadDataAsync($uri), " |
| + "${_numOutstandingLoadRequests} requests outstanding"); |
| + } |
| if (sourceUri.scheme == 'http') { |
| _httpGet(sourceUri, libraryUri, (data) { |
| _loadScript(tag, uri, libraryUri, data); |
| @@ -350,8 +347,9 @@ _extensionPathFromUri(String userUri) { |
| } else if (Platform.isWindows) { |
| filename = '$name.dll'; |
| } else { |
| - _logResolution( |
| - 'Native extensions not supported on ${Platform.operatingSystem}'); |
| + if (_logBuiltin) { |
| + _print('Native extensions not supported on ${Platform.operatingSystem}'); |
| + } |
| throw 'Native extensions not supported on ${Platform.operatingSystem}'; |
| } |