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

Unified Diff: Source/bindings/dart/custom/DartWindowCustom.cpp

Issue 313183003: [dartium] Use ScriptWrappable when there are multiple Dart wrappers. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: Created 6 years, 6 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 | « Source/bindings/dart/DartScriptWrappable.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/custom/DartWindowCustom.cpp
diff --git a/Source/bindings/dart/custom/DartWindowCustom.cpp b/Source/bindings/dart/custom/DartWindowCustom.cpp
index d962408be3bdcb3b3857232291ec01fc0f8acd59..5f8811f1d8e3a1e0eb93661b53717ba30e9c91d1 100644
--- a/Source/bindings/dart/custom/DartWindowCustom.cpp
+++ b/Source/bindings/dart/custom/DartWindowCustom.cpp
@@ -75,6 +75,12 @@ void historyCrossFrameGetter(Dart_NativeArguments args)
DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args);
DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateData(args));
+ Dart_WeakPersistentHandle existingWrapper = DartDOMWrapper::lookupWrapper<DartHistory>(domData, &receiver->history());
+ if (existingWrapper) {
+ Dart_SetWeakHandleReturnValue(args, existingWrapper);
+ return;
+ }
+
Dart_Handle result = DartDOMWrapper::createWrapper<DartHistory>(
domData, &receiver->history(), _HistoryCrossFrameClassId);
if (result)
@@ -88,6 +94,12 @@ void locationCrossFrameGetter(Dart_NativeArguments args)
DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args);
DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateData(args));
+ Dart_WeakPersistentHandle existingWrapper = DartDOMWrapper::lookupWrapper<DartLocation>(domData, &receiver->location());
+ if (existingWrapper) {
+ Dart_SetWeakHandleReturnValue(args, existingWrapper);
+ return;
+ }
+
Dart_Handle result = DartDOMWrapper::createWrapper<DartLocation>(
domData, &receiver->location(), _LocationCrossFrameClassId);
if (result)
« no previous file with comments | « Source/bindings/dart/DartScriptWrappable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698