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

Side by Side Diff: tools/dom/templates/html/impl/impl_Blob.darttemplate

Issue 410823002: Revert "Use @Native annotation on dart2js DOM native classes" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
8 $!MEMBERS 8 $!MEMBERS
9 $if DART2JS 9 $if DART2JS
10 factory Blob(List blobParts, [String type, String endings]) { 10 factory Blob(List blobParts, [String type, String endings]) {
11 // TODO: validate that blobParts is a JS Array and convert if not. 11 // TODO: validate that blobParts is a JS Array and convert if not.
12 // TODO: any coercions on the elements of blobParts, e.g. coerce a typed 12 // TODO: any coercions on the elements of blobParts, e.g. coerce a typed
13 // array to ArrayBuffer if it is a total view. 13 // array to ArrayBuffer if it is a total view.
14 if (type == null && endings == null) { 14 if (type == null && endings == null) {
15 return _create_1(blobParts); 15 return _create_1(blobParts);
16 } 16 }
17 var bag = _create_bag(); 17 var bag = _create_bag();
18 if (type != null) _bag_set(bag, 'type', type); 18 if (type != null) _bag_set(bag, 'type', type);
19 if (endings != null) _bag_set(bag, 'endings', endings); 19 if (endings != null) _bag_set(bag, 'endings', endings);
20 return _create_2(blobParts, bag); 20 return _create_2(blobParts, bag);
21 } 21 }
22 22
23 static _create_1(parts) => JS('Blob', 'new Blob(#)', parts); 23 static _create_1(parts) => JS('Blob', 'new Blob(#)', parts);
24 static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag); 24 static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag);
25 25
26 static _create_bag() => JS('var', '{}'); 26 static _create_bag() => JS('var', '{}');
27 static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); } 27 static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
28 $endif 28 $endif
29 } 29 }
30
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698