OLD | NEW |
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // FIXME: the fact that we return 0 on error rather than asserting is | 260 // FIXME: the fact that we return 0 on error rather than asserting is |
261 // somewhat of a hack. We currently make this method return 0 because | 261 // somewhat of a hack. We currently make this method return 0 because |
262 // we reuse this method to verify that objects are actually native | 262 // we reuse this method to verify that objects are actually native |
263 // Node objects rather than objects that implement the Node interface. | 263 // Node objects rather than objects that implement the Node interface. |
264 if (Dart_IsError(result)) | 264 if (Dart_IsError(result)) |
265 return 0; | 265 return 0; |
266 return reinterpret_cast<void*>(value); | 266 return reinterpret_cast<void*>(value); |
267 } | 267 } |
268 | 268 |
269 template <class BindingsClass> | 269 template <class BindingsClass> |
270 static void wrapperWeakCallback(Dart_WeakPersistentHandle wrapper, void* pee
r) | 270 static void wrapperWeakCallback(Dart_Isolate isolate, Dart_WeakPersistentHan
dle wrapper, void* peer) |
271 { | 271 { |
272 typedef DartDOMWrapperTraits<BindingsClass> Traits; | 272 typedef DartDOMWrapperTraits<BindingsClass> Traits; |
273 DartDOMData* domData = DartDOMData::current(); | 273 DartDOMData* domData = reinterpret_cast<DartDOMData*>(Dart_IsolateData(i
solate)); |
274 typename BindingsClass::NativeType* domObject = static_cast<typename Bin
dingsClass::NativeType*>(peer); | 274 typename BindingsClass::NativeType* domObject = static_cast<typename Bin
dingsClass::NativeType*>(peer); |
275 Dart_WeakPersistentHandle currentWrapper = Traits::MapTraits::domMap(dom
Data)->get(domObject); | 275 Dart_WeakPersistentHandle currentWrapper = Traits::MapTraits::domMap(dom
Data)->get(domObject); |
276 // This could be an old wrapper which has been replaced with a custom el
ement. | 276 // This could be an old wrapper which has been replaced with a custom el
ement. |
277 if (currentWrapper != wrapper) { | 277 if (currentWrapper != wrapper) { |
278 #ifdef DEBUG | 278 #ifdef DEBUG |
279 DartApiScope scope; | 279 DartApiScope scope; |
280 ASSERT(!Dart_IdentityEquals(Dart_HandleFromWeakPersistent(currentWra
pper), Dart_HandleFromWeakPersistent(wrapper))); | 280 ASSERT(!Dart_IdentityEquals(Dart_HandleFromWeakPersistent(currentWra
pper), Dart_HandleFromWeakPersistent(wrapper))); |
281 #endif | 281 #endif |
282 return; | 282 return; |
283 } | 283 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } | 396 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } |
397 }; | 397 }; |
398 typedef MessagePortMapTraits MapTraits; | 398 typedef MessagePortMapTraits MapTraits; |
399 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; | 399 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; |
400 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr
aits; | 400 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr
aits; |
401 }; | 401 }; |
402 | 402 |
403 } | 403 } |
404 | 404 |
405 #endif // DartDOMWrapper_h | 405 #endif // DartDOMWrapper_h |
OLD | NEW |