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

Side by Side Diff: mojo/dart/embedder/builtin.dart

Issue 1640933003: Dart: Roll runtime forward (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « DEPS ('k') | mojo/dart/embedder/dart_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library mojo_builtin; 5 library mojo_builtin;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:mojo.internal'; 9 import 'dart:mojo.internal';
10 10
11 // Corelib 'print' implementation. 11 // Corelib 'print' implementation.
12 void _print(arg) { 12 void _print(arg) {
13 _Logger._printString(arg.toString()); 13 _Logger._printString(arg.toString());
14 } 14 }
15 15
16 class _Logger { 16 class _Logger {
17 static void _printString(String s) native "Logger_PrintString"; 17 static void _printString(String s) native "Logger_PrintString";
18 } 18 }
19 19
20 String _rawUriBase; 20 String _rawUriBase;
21 Uri _cachedUriBase; 21 Uri _cachedUriBase;
22 Uri _uriBase() { 22 Uri _uriBase() {
23 if (_cachedUriBase != null) { 23 if (_cachedUriBase != null) {
24 return _cachedUriBase; 24 return _cachedUriBase;
25 } 25 }
26 _cachedUriBase = Uri.parse(_rawUriBase); 26 _cachedUriBase = Uri.parse(_rawUriBase);
27 return _cachedUriBase; 27 return _cachedUriBase;
28 } 28 }
29 29
30 String _rawScript;
31 Uri _scriptUri() {
32 if (_rawScript.startsWith('http:') ||
33 _rawScript.startsWith('https:') ||
34 _rawScript.startsWith('file:')) {
35 return Uri.parse(_rawScript);
36 } else {
37 return Uri.base.resolveUri(new Uri.file(_rawScript));
38 }
39 }
40
30 _setupHooks() { 41 _setupHooks() {
31 VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer; 42 VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer;
32 VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock; 43 VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock;
44
45 // TODO(zra): When the Dart issue here:
46 // https://github.com/dart-lang/sdk/issues/25603
47 // is resolved, there will be no need to eagerly compute the script URI.
48 VMLibraryHooks.platformScript = _scriptUri();
33 } 49 }
34 50
35 _getUriBaseClosure() => _uriBase; 51 _getUriBaseClosure() => _uriBase;
36 _getPrintClosure() => _print; 52 _getPrintClosure() => _print;
37 53
38 // import 'root_library'; happens here from C Code 54 // import 'root_library'; happens here from C Code
39 // The root library (aka the script) is imported into this library. The 55 // The root library (aka the script) is imported into this library. The
40 // embedder uses this to lookup the main entrypoint in the root library's 56 // embedder uses this to lookup the main entrypoint in the root library's
41 // namespace. 57 // namespace.
42 Function _getMainClosure() => main; 58 Function _getMainClosure() => main;
OLDNEW
« no previous file with comments | « DEPS ('k') | mojo/dart/embedder/dart_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698