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

Unified Diff: Source/bindings/dart/DartNativeUtilities.cpp

Issue 188083002: Dartium support for manual custom element upgrades. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1750
Patch Set: Created 6 years, 8 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/DartCustomElementWrapper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartNativeUtilities.cpp
diff --git a/Source/bindings/dart/DartNativeUtilities.cpp b/Source/bindings/dart/DartNativeUtilities.cpp
index 3adb0dce7d6efc889fb1f3bf0495eb59ed3fff8e..730d5c4f2847117046d4af9b86dcce264d3af658 100644
--- a/Source/bindings/dart/DartNativeUtilities.cpp
+++ b/Source/bindings/dart/DartNativeUtilities.cpp
@@ -237,6 +237,36 @@ fail:
ASSERT_NOT_REACHED();
}
+void changeElementWrapper(Dart_NativeArguments args)
+{
+ Dart_Handle exception = 0;
+ {
+ Dart_Handle elementWrapper = Dart_GetNativeArgument(args, 0);
+ if (!DartDOMWrapper::subtypeOf(elementWrapper, DartHTMLElement::dartClassId)) {
+ exception = Dart_NewStringFromCString("Invalid class: expected instance of HtmlElement");
+ goto fail;
+ }
+
+ Dart_Handle wrapperType = Dart_GetNativeArgument(args, 1);
+ if (!Dart_IsType(wrapperType)) {
+ exception = Dart_NewStringFromCString("Expected instance of Type");
+ goto fail;
+ }
+
+ Dart_Handle newWrapper = DartCustomElementWrapper<HTMLElement>::changeElementWrapper(elementWrapper, wrapperType);
+ if (Dart_IsError(newWrapper)) {
+ exception = newWrapper;
+ goto fail;
+ }
+ Dart_SetReturnValue(args, newWrapper);
+ return;
+ }
+
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
+
} // namespace DartNativeUtilitiesInternal
namespace DartWindowInternal {
@@ -274,6 +304,8 @@ Dart_NativeFunction domIsolateHtmlResolver(Dart_Handle name, int argumentCount,
return DartNativeUtilitiesInternal::createElement;
if (argumentCount == 1 && str == "Utils_initializeCustomElement")
return DartNativeUtilitiesInternal::initializeCustomElement;
+ if (argumentCount == 2 && str == "Utils_changeElementWrapper")
+ return DartNativeUtilitiesInternal::changeElementWrapper;
if (argumentCount == 1 && str == "Utils_spawnDomUri")
return DartNativeUtilitiesInternal::spawnDomUri;
if (argumentCount == 1 && str == "Window_history_cross_frame_Getter")
« no previous file with comments | « Source/bindings/dart/DartCustomElementWrapper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698