| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 template <class BindingsClass> | 315 template <class BindingsClass> |
| 316 static void associateWrapper( | 316 static void associateWrapper( |
| 317 DartDOMData* domData, typename BindingsClass::NativeType* domObject, Dar
t_Handle newInstance) | 317 DartDOMData* domData, typename BindingsClass::NativeType* domObject, Dar
t_Handle newInstance) |
| 318 { | 318 { |
| 319 typedef DartDOMWrapperTraits<BindingsClass> Traits; | 319 typedef DartDOMWrapperTraits<BindingsClass> Traits; |
| 320 void* blinkHandle = Traits::GCTraits::ref(domObject); | 320 void* blinkHandle = Traits::GCTraits::ref(domObject); |
| 321 // This is only used to inform the Dart garbage collector on how much ex
ternal memory | 321 // This is only used to inform the Dart garbage collector on how much ex
ternal memory |
| 322 // is kept alive. | 322 // is kept alive. |
| 323 intptr_t externalAllocationSize = sizeof(*domObject); | 323 intptr_t externalAllocationSize = sizeof(*domObject); |
| 324 | 324 |
| 325 Dart_WeakPersistentHandle wrapper = Dart_NewPrologueWeakPersistentHandle
( | 325 Dart_WeakPersistentHandle wrapper = Dart_NewWeakPersistentHandle( |
| 326 newInstance, blinkHandle, externalAllocationSize, &wrapperWeakCallba
ck<BindingsClass>); | 326 newInstance, blinkHandle, externalAllocationSize, &wrapperWeakCallba
ck<BindingsClass>); |
| 327 Traits::MapTraits::domMap(domData)->set(domObject, wrapper); | 327 Traits::MapTraits::domMap(domData)->set(domObject, wrapper); |
| 328 } | 328 } |
| 329 | 329 |
| 330 template <class BindingsClass> | 330 template <class BindingsClass> |
| 331 static void disassociateWrapper( | 331 static void disassociateWrapper( |
| 332 DartDOMData* domData, typename BindingsClass::NativeType* domObject, Dar
t_Handle oldInstance) | 332 DartDOMData* domData, typename BindingsClass::NativeType* domObject, Dar
t_Handle oldInstance) |
| 333 { | 333 { |
| 334 typedef DartDOMWrapperTraits<BindingsClass> Traits; | 334 typedef DartDOMWrapperTraits<BindingsClass> Traits; |
| 335 | 335 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 struct MessagePortMapTraits { | 405 struct MessagePortMapTraits { |
| 406 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } | 406 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } |
| 407 }; | 407 }; |
| 408 typedef MessagePortMapTraits MapTraits; | 408 typedef MessagePortMapTraits MapTraits; |
| 409 typedef DartDOMWrapperGarbageCollectedTraits<DartMessagePort, false> GCTrait
s; | 409 typedef DartDOMWrapperGarbageCollectedTraits<DartMessagePort, false> GCTrait
s; |
| 410 }; | 410 }; |
| 411 | 411 |
| 412 } | 412 } |
| 413 | 413 |
| 414 #endif // DartDOMWrapper_h | 414 #endif // DartDOMWrapper_h |
| OLD | NEW |