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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012, Google Inc. 1 // Copyright 2012, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // TODO(vsm): Return isolate future. 230 // TODO(vsm): Return isolate future.
231 dartController->spawnDomUri(uri); 231 dartController->spawnDomUri(uri);
232 return; 232 return;
233 } 233 }
234 234
235 fail: 235 fail:
236 Dart_ThrowException(exception); 236 Dart_ThrowException(exception);
237 ASSERT_NOT_REACHED(); 237 ASSERT_NOT_REACHED();
238 } 238 }
239 239
240 void changeElementWrapper(Dart_NativeArguments args)
241 {
242 Dart_Handle exception = 0;
243 {
244 Dart_Handle elementWrapper = Dart_GetNativeArgument(args, 0);
245 if (!DartDOMWrapper::subtypeOf(elementWrapper, DartHTMLElement::dartClas sId)) {
246 exception = Dart_NewStringFromCString("Invalid class: expected insta nce of HtmlElement");
247 goto fail;
248 }
249
250 Dart_Handle wrapperType = Dart_GetNativeArgument(args, 1);
251 if (!Dart_IsType(wrapperType)) {
vsm 2014/04/16 21:33:05 How do we validate that this is an allowable type
blois 2014/04/16 22:18:51 Much of the code is shared with the custom element
252 exception = Dart_NewStringFromCString("Expected instance of Type");
253 goto fail;
254 }
255
256 Dart_Handle newWrapper = DartCustomElementWrapper<HTMLElement>::changeEl ementWrapper(elementWrapper, wrapperType);
257 if (Dart_IsError(newWrapper)) {
258 exception = newWrapper;
259 goto fail;
260 }
261 Dart_SetReturnValue(args, newWrapper);
262 return;
263 }
264
265 fail:
266 Dart_ThrowException(exception);
267 ASSERT_NOT_REACHED();
268 }
269
240 } // namespace DartNativeUtilitiesInternal 270 } // namespace DartNativeUtilitiesInternal
241 271
242 namespace DartWindowInternal { 272 namespace DartWindowInternal {
243 273
244 void historyCrossFrameGetter(Dart_NativeArguments); 274 void historyCrossFrameGetter(Dart_NativeArguments);
245 275
246 void locationCrossFrameGetter(Dart_NativeArguments); 276 void locationCrossFrameGetter(Dart_NativeArguments);
247 277
248 } 278 }
249 279
(...skipping 17 matching lines...) Expand all
267 if (argumentCount == 1 && str == "Utils_forwardingPrint") 297 if (argumentCount == 1 && str == "Utils_forwardingPrint")
268 return DartNativeUtilitiesInternal::forwardingPrint; 298 return DartNativeUtilitiesInternal::forwardingPrint;
269 if (argumentCount == 0 && str == "Utils_getNewIsolateId") 299 if (argumentCount == 0 && str == "Utils_getNewIsolateId")
270 return DartNativeUtilitiesInternal::getNewIsolateId; 300 return DartNativeUtilitiesInternal::getNewIsolateId;
271 if (argumentCount == 4 && str == "Utils_register") 301 if (argumentCount == 4 && str == "Utils_register")
272 return DartNativeUtilitiesInternal::registerElement; 302 return DartNativeUtilitiesInternal::registerElement;
273 if (argumentCount == 2 && str == "Utils_createElement") 303 if (argumentCount == 2 && str == "Utils_createElement")
274 return DartNativeUtilitiesInternal::createElement; 304 return DartNativeUtilitiesInternal::createElement;
275 if (argumentCount == 1 && str == "Utils_initializeCustomElement") 305 if (argumentCount == 1 && str == "Utils_initializeCustomElement")
276 return DartNativeUtilitiesInternal::initializeCustomElement; 306 return DartNativeUtilitiesInternal::initializeCustomElement;
307 if (argumentCount == 2 && str == "Utils_changeElementWrapper")
308 return DartNativeUtilitiesInternal::changeElementWrapper;
277 if (argumentCount == 1 && str == "Utils_spawnDomUri") 309 if (argumentCount == 1 && str == "Utils_spawnDomUri")
278 return DartNativeUtilitiesInternal::spawnDomUri; 310 return DartNativeUtilitiesInternal::spawnDomUri;
279 if (argumentCount == 1 && str == "Window_history_cross_frame_Getter") 311 if (argumentCount == 1 && str == "Window_history_cross_frame_Getter")
280 return DartWindowInternal::historyCrossFrameGetter; 312 return DartWindowInternal::historyCrossFrameGetter;
281 if (argumentCount == 1 && str == "Window_location_cross_frame_Getter") 313 if (argumentCount == 1 && str == "Window_location_cross_frame_Getter")
282 return DartWindowInternal::locationCrossFrameGetter; 314 return DartWindowInternal::locationCrossFrameGetter;
283 return 0; 315 return 0;
284 } 316 }
285 317
286 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698