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

Side by Side Diff: lib/src/common/js_proxy.dart

Issue 1351693003: Update to use one less proxy per element (Closed) Base URL: git@github.com:dart-lang/polymer-dart.git@behaviors
Patch Set: redo! Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library polymer.lib.src.common.js_proxy; 4 library polymer.lib.src.common.js_proxy;
5 5
6 import 'dart:js'; 6 import 'dart:js';
7 import 'package:polymer_interop/polymer_interop.dart'; 7 import 'package:polymer_interop/polymer_interop.dart';
8 export 'package:polymer_interop/polymer_interop.dart' show dartValue, jsValue; 8 export 'package:polymer_interop/polymer_interop.dart' show dartValue, jsValue;
9 import 'package:reflectable/reflectable.dart'; 9 import 'package:reflectable/reflectable.dart';
10 import 'behavior.dart'; 10 import 'behavior.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 : super( 55 : super(
56 instanceInvokeCapability, 56 instanceInvokeCapability,
57 metadataCapability, 57 metadataCapability,
58 declarationsCapability, 58 declarationsCapability,
59 typeCapability, 59 typeCapability,
60 typeRelationsCapability, 60 typeRelationsCapability,
61 subtypeQuantifyCapability, 61 subtypeQuantifyCapability,
62 superclassQuantifyCapability, 62 superclassQuantifyCapability,
63 const StaticInvokeCapability('hostAttributes')); 63 const StaticInvokeCapability('hostAttributes'));
64 } 64 }
65
66 const jsProxyReflectable = const JsProxyReflectable(); 65 const jsProxyReflectable = const JsProxyReflectable();
67 66
68 final JsObject _polymerDart = context['Polymer']['Dart']; 67 final JsObject _polymerDart = context['Polymer']['Dart'];
69 68
70 /// Given a dart type, this creates a javascript constructor and prototype 69 /// Given a dart type, this creates a javascript constructor and prototype
71 /// which can act as a proxy for it. 70 /// which can act as a proxy for it.
72 JsFunction _buildJsConstructorForType(Type dartType) { 71 JsFunction _buildJsConstructorForType(Type dartType) {
73 var constructor = _polymerDart.callMethod('functionFactory'); 72 var constructor = _polymerDart.callMethod('functionFactory');
74 var prototype = new JsObject(context['Object']); 73 var prototype = new JsObject(context['Object']);
75 74
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 var mirror = jsProxyReflectable.reflect(dartInstance); 110 var mirror = jsProxyReflectable.reflect(dartInstance);
112 return jsValue(mirror.invoke(name, newArgs)); 111 return jsValue(mirror.invoke(name, newArgs));
113 } 112 }
114 ]); 113 ]);
115 } 114 }
116 }); 115 });
117 116
118 constructor['prototype'] = prototype; 117 constructor['prototype'] = prototype;
119 return constructor; 118 return constructor;
120 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698