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

Side by Side Diff: bin/dwc_browser.dart

Issue 11305009: Fix dwc extension with latest js-interop, small fix to dwc, and updates to (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 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
« no previous file with comments | « no previous file | example/explainer/build_examples.dart » ('j') | extension/background.html » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * Compiles Dart Web Components from within a Chrome extension. 6 * Compiles Dart Web Components from within a Chrome extension.
7 * The Chrome extension logic exists outside of Dart as Dart does not support 7 * The Chrome extension logic exists outside of Dart as Dart does not support
8 * Chrome extension APIs at this time. 8 * Chrome extension APIs at this time.
9 */ 9 */
10 library dwc_browser; 10 library dwc_browser;
(...skipping 11 matching lines...) Expand all
22 22
23 FileSystem fileSystem; 23 FileSystem fileSystem;
24 24
25 void main() { 25 void main() {
26 js.scoped(() { 26 js.scoped(() {
27 js.context.setOnParseCallback(new js.Callback.many(parse)); 27 js.context.setOnParseCallback(new js.Callback.many(parse));
28 }); 28 });
29 } 29 }
30 30
31 /** 31 /**
32 * Parse all templates in [sourceFullFn]. 32 * Process the input file at [sourceUri] with the 'dwc' compiler.
33 * [sourcePagePort] is a Chrome extension port used to communicate back to the 33 * [sourcePagePort] is a Chrome extension port used to communicate back to the
34 * source page that will consume these proxied urls. 34 * source page that will consume these proxied urls.
35 * See extension/background.js. 35 * See extension/background.js.
36 */ 36 */
37 void parse(js.Proxy sourcePagePort, String sourceFullFn) { 37 void parse(js.Proxy sourcePagePort, String sourceUri) {
38 // TODO(jacobr): we need to send error messages back to sourcePagePort. 38 // TODO(jacobr): we need to send error messages back to sourcePagePort.
39 js.retain(sourcePagePort); 39 js.retain(sourcePagePort);
40 print("Processing: $sourceFullFn"); 40 print("Processing: $sourceUri");
41 41 Uri uri = new Uri.fromString(sourceUri);
42 Uri uri = new Uri.fromString(sourceFullFn);
43 fileSystem = new BrowserFileSystem(uri.scheme, sourcePagePort); 42 fileSystem = new BrowserFileSystem(uri.scheme, sourcePagePort);
44 // TODO(jacobr): provide a way to pass in options. 43 // TODO(jacobr): provide a way to pass in options.
45 var options = CompilerOptions.parse(['--no-colors', uri.path]); 44 var options = CompilerOptions.parse(['--no-colors', uri.path]);
46 messages = new Messages(options: options); 45 messages = new Messages(options: options);
47 asyncTime('Compiled $sourceFullFn', () { 46 asyncTime('Compiled $sourceUri', () {
48 var compiler = new Compiler(fileSystem, options); 47 var compiler = new Compiler(fileSystem, options);
49 return compiler.run().chain((_) { 48 return compiler.run().chain((_) {
50 for (var file in compiler.output) { 49 for (var file in compiler.output) {
51 fileSystem.writeString(file.path, file.contents); 50 fileSystem.writeString(file.path, file.contents);
52 } 51 }
53 var ret = fileSystem.flush(); 52 var ret = fileSystem.flush();
54 js.release(sourcePagePort); 53 js.release(sourcePagePort);
55 return ret; 54 return ret;
56 }); 55 });
57 }, printTime: true); 56 }, printTime: true);
58 } 57 }
OLDNEW
« no previous file with comments | « no previous file | example/explainer/build_examples.dart » ('j') | extension/background.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698