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

Unified Diff: sdk/lib/_internal/js_runtime/lib/interceptors.dart

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/native_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/interceptors.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/interceptors.dart b/sdk/lib/_internal/js_runtime/lib/interceptors.dart
index f13c3f8f4200f300fd51e1f9d8b9131a3f6cace1..23025ad578cc34276949080428a92a0e7b49fcab 100644
--- a/sdk/lib/_internal/js_runtime/lib/interceptors.dart
+++ b/sdk/lib/_internal/js_runtime/lib/interceptors.dart
@@ -168,16 +168,7 @@ getNativeInterceptor(object) {
}
}
- // Check for cached UnknownJavaScriptObject. This avoids doing the slow
- // dispatch-record based lookup for repeated js-interop classes.
- var constructor = JS('', '#.constructor', object);
- var interceptor = JS('', '#.get(#)', constructorToInterceptor, constructor);
- if (interceptor != null) return interceptor;
-
- // This takes care of dispatch-record based caching, but not constructor based
- // caching of [UnknownJavaScriptObject]s.
- interceptor = lookupAndCacheInterceptor(object);
-
+ var interceptor = lookupAndCacheInterceptor(object);
if (interceptor == null) {
// JavaScript Objects created via object literals and `Object.create(null)`
// are 'plain' Objects. This test could be simplified and the dispatch path
@@ -189,10 +180,6 @@ getNativeInterceptor(object) {
var proto = JS('', 'Object.getPrototypeOf(#)', object);
if (JS('bool', '# == null || # === Object.prototype', proto, proto)) {
return JS_INTERCEPTOR_CONSTANT(PlainJavaScriptObject);
- } else if (JS('bool', 'typeof # == "function"', constructor)) {
- interceptor = JS_INTERCEPTOR_CONSTANT(UnknownJavaScriptObject);
- JS('', '#.set(#, #)', constructorToInterceptor, constructor, interceptor);
- return interceptor;
} else {
return JS_INTERCEPTOR_CONSTANT(UnknownJavaScriptObject);
}
@@ -201,9 +188,6 @@ getNativeInterceptor(object) {
return interceptor;
}
-var constructorToInterceptor =
- JS('', 'typeof(self.WeakMap) == "undefined" ? new Map() : new WeakMap()');
-
/**
* Data structure used to map a [Type] to the [Interceptor] and constructors for
* that type. It is JavaScript array of 3N entries of adjacent slots containing
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/native_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698