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

Side by Side Diff: dart/site/try/src/compilation.dart

Issue 298273002: Share source code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/site/try/src/leap.dart » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 trydart.compilation; 5 library trydart.compilation;
6 6
7 import 'dart:html' show 7 import 'dart:html' show
8 AnchorElement,
8 Blob, 9 Blob,
9 Element, 10 Element,
10 ErrorEvent, 11 ErrorEvent,
11 IFrameElement, 12 IFrameElement,
12 MessageEvent, 13 MessageEvent,
13 Url, 14 Url,
14 Worker, 15 Worker,
16 document,
15 window; 17 window;
16 18
17 import 'dart:async' show 19 import 'dart:async' show
18 Timer; 20 Timer;
19 21
20 import 'dart:isolate' show 22 import 'dart:isolate' show
21 ReceivePort, 23 ReceivePort,
22 SendPort; 24 SendPort;
23 25
24 import 'editor.dart' show 26 import 'editor.dart' show
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 */ 61 */
60 const String PRIVATE_SCHEME = 'org-trydart'; 62 const String PRIVATE_SCHEME = 'org-trydart';
61 63
62 SendPort compilerPort; 64 SendPort compilerPort;
63 65
64 // TODO(ahe): Remove this. 66 // TODO(ahe): Remove this.
65 String get currentSource => window.localStorage['currentSource']; 67 String get currentSource => window.localStorage['currentSource'];
66 68
67 void set currentSource(String text) { 69 void set currentSource(String text) {
68 window.localStorage['currentSource'] = text; 70 window.localStorage['currentSource'] = text;
71 AnchorElement a = document.querySelector('#share-link');
72 if (a != null) {
73 String sourceQuery = '?source=${Uri.encodeQueryComponent(text)}';
74 a.href = '${Uri.base.resolve(sourceQuery)}';
75 }
69 } 76 }
70 77
71 bool startCompilation() { 78 bool startCompilation() {
72 if (!CompilationProcess.shouldStartCompilation()) return false; 79 if (!CompilationProcess.shouldStartCompilation()) return false;
73 new CompilationProcess(currentSource, outputDiv).start(); 80 new CompilationProcess(currentSource, outputDiv).start();
74 return true; 81 return true;
75 } 82 }
76 83
77 class CompilationProcess { 84 class CompilationProcess {
78 final String source; 85 final String source;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 compile(list[0], list[1]); 304 compile(list[0], list[1]);
298 } catch (exception, stack) { 305 } catch (exception, stack) {
299 port.send('$exception\n$stack'); 306 port.send('$exception\n$stack');
300 } 307 }
301 }); 308 });
302 var notTrue = false; // Confuse the analyzer. 309 var notTrue = false; // Confuse the analyzer.
303 if (notTrue) { 310 if (notTrue) {
304 cacheCompiler.compilerFor(null); 311 cacheCompiler.compilerFor(null);
305 } 312 }
306 } 313 }
OLDNEW
« no previous file with comments | « no previous file | dart/site/try/src/leap.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698