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

Side by Side Diff: Source/bindings/dart/DartDOMWrapper.h

Issue 54833003: Fixing another case of multiple upgrades of a custom element (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // FIXME: the fact that we return 0 on error rather than asserting is 265 // FIXME: the fact that we return 0 on error rather than asserting is
266 // somewhat of a hack. We currently make this method return 0 because 266 // somewhat of a hack. We currently make this method return 0 because
267 // we reuse this method to verify that objects are actually native 267 // we reuse this method to verify that objects are actually native
268 // Node objects rather than objects that implement the Node interface. 268 // Node objects rather than objects that implement the Node interface.
269 if (Dart_IsError(result)) 269 if (Dart_IsError(result))
270 return 0; 270 return 0;
271 return reinterpret_cast<void*>(value); 271 return reinterpret_cast<void*>(value);
272 } 272 }
273 273
274 template <class BindingsClass> 274 template <class BindingsClass>
275 static void wrapperWeakCallback(Dart_WeakPersistentHandle, void* peer) 275 static void wrapperWeakCallback(Dart_WeakPersistentHandle wrapper, void* pee r)
276 { 276 {
277 typedef DartDOMWrapperTraits<BindingsClass> Traits; 277 typedef DartDOMWrapperTraits<BindingsClass> Traits;
278 DartDOMData* domData = DartDOMData::current(); 278 DartDOMData* domData = DartDOMData::current();
279 typename BindingsClass::NativeType* domObject = static_cast<typename Bin dingsClass::NativeType*>(peer); 279 typename BindingsClass::NativeType* domObject = static_cast<typename Bin dingsClass::NativeType*>(peer);
280 Dart_WeakPersistentHandle currentWrapper = Traits::MapTraits::domMap(dom Data)->get(domObject);
vsm 2013/10/31 23:19:43 Looking the IDB failures - if they are from this -
281 // This could be an old wrapper which has been replaced with a custom el ement.
282 if (currentWrapper != wrapper) {
283 ASSERT(!Dart_IdentityEquals(Dart_HandleFromWeakPersistent(currentWra pper), Dart_HandleFromWeakPersistent(wrapper)));
284 return;
285 }
286
280 if (DartDOMWrapperTraits<BindingsClass>::MapTraits::domMap(domData)->con tains(domObject)) { 287 if (DartDOMWrapperTraits<BindingsClass>::MapTraits::domMap(domData)->con tains(domObject)) {
281 Traits::MapTraits::domMap(domData)->remove(domObject); 288 Traits::MapTraits::domMap(domData)->remove(domObject);
282 Traits::ActiveTraits::removeWrapper(domData, domObject); 289 Traits::ActiveTraits::removeWrapper(domData, domObject);
283 Traits::EventTargetTraits::removeWrapper(domData, domObject); 290 Traits::EventTargetTraits::removeWrapper(domData, domObject);
284 } 291 }
285 domObject->deref(); 292 domObject->deref();
286 } 293 }
287 294
288 template <class BindingsClass> 295 template <class BindingsClass>
289 static void associateWrapper( 296 static void associateWrapper(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData ->messagePortMap(); } 398 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData ->messagePortMap(); }
392 }; 399 };
393 typedef MessagePortMapTraits MapTraits; 400 typedef MessagePortMapTraits MapTraits;
394 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; 401 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits;
395 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr aits; 402 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr aits;
396 }; 403 };
397 404
398 } 405 }
399 406
400 #endif // DartDOMWrapper_h 407 #endif // DartDOMWrapper_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698