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

Side by Side Diff: tools/dom/src/dart2js_Conversions.dart

Issue 17574008: Fixing DateTime values in dart2js serialized script values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « tools/dom/scripts/generator.py ('k') | no next file » | 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) 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 // Conversions for Window. These check if the window is the local 6 // Conversions for Window. These check if the window is the local
7 // window, and if it's not, wraps or unwraps it with a secure wrapper. 7 // window, and if it's not, wraps or unwraps it with a secure wrapper.
8 // We need to test for EventTarget here as well as it's a base type. 8 // We need to test for EventTarget here as well as it's a base type.
9 // We omit an unwrapper for Window as no methods take a non-local 9 // We omit an unwrapper for Window as no methods take a non-local
10 // window as a parameter. 10 // window as a parameter.
11 11
12 part of html; 12 part of html;
13 13
14 DateTime _convertNativeToDart_DateTime(date) {
15 var millisSinceEpoch = JS('int', '#.getTime()', date);
16 return new DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, isUtc: true);
17 }
18
19 _convertDartToNative_DateTime(DateTime date) {
20 return JS('', 'new Date(#)', date.millisecondsSinceEpoch);
21 }
22
23 WindowBase _convertNativeToDart_Window(win) { 14 WindowBase _convertNativeToDart_Window(win) {
24 if (win == null) return null; 15 if (win == null) return null;
25 return _DOMWindowCrossFrame._createSafe(win); 16 return _DOMWindowCrossFrame._createSafe(win);
26 } 17 }
27 18
28 EventTarget _convertNativeToDart_EventTarget(e) { 19 EventTarget _convertNativeToDart_EventTarget(e) {
29 if (e == null) { 20 if (e == null) {
30 return null; 21 return null;
31 } 22 }
32 // Assume it's a Window if it contains the setInterval property. It may be 23 // Assume it's a Window if it contains the setInterval property. It may be
(...skipping 11 matching lines...) Expand all
44 return e; 35 return e;
45 } 36 }
46 37
47 EventTarget _convertDartToNative_EventTarget(e) { 38 EventTarget _convertDartToNative_EventTarget(e) {
48 if (e is _DOMWindowCrossFrame) { 39 if (e is _DOMWindowCrossFrame) {
49 return e._window; 40 return e._window;
50 } else { 41 } else {
51 return e; 42 return e;
52 } 43 }
53 } 44 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698