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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 DartApiScope scope; | 181 DartApiScope scope; |
182 Dart_Handle result = Dart_SetNativeInstanceField(wrapper, index, reinter pret_cast<intptr_t>(pointer)); | 182 Dart_Handle result = Dart_SetNativeInstanceField(wrapper, index, reinter pret_cast<intptr_t>(pointer)); |
183 UNUSED_PARAM(result); | 183 UNUSED_PARAM(result); |
184 ASSERT(!Dart_IsError(result)); | 184 ASSERT(!Dart_IsError(result)); |
185 } | 185 } |
186 | 186 |
187 static void* readNativePointer(Dart_Handle wrapper, int index) | 187 static void* readNativePointer(Dart_Handle wrapper, int index) |
188 { | 188 { |
189 intptr_t value; | 189 intptr_t value; |
190 Dart_Handle result = Dart_GetNativeInstanceField(wrapper, index, &value) ; | 190 Dart_Handle result = Dart_GetNativeInstanceField(wrapper, index, &value) ; |
191 ASSERT(!Dart_IsError(result)); | 191 if (Dart_IsError(result)) |
Anton Muhin
2013/07/16 13:27:40
btw, that would lead to crashes as we don't want t
Jacob
2013/07/16 16:44:59
Would you like me to add a separate method
maybeRe
| |
192 UNUSED_PARAM(result); | 192 return 0; |
193 return reinterpret_cast<void*>(value); | 193 return reinterpret_cast<void*>(value); |
194 } | 194 } |
195 | 195 |
196 template <class BindingsClass> | 196 template <class BindingsClass> |
197 static void wrapperWeakCallback(Dart_WeakPersistentHandle, void* peer) | 197 static void wrapperWeakCallback(Dart_WeakPersistentHandle, void* peer) |
198 { | 198 { |
199 typedef DartDOMWrapperTraits<BindingsClass> Traits; | 199 typedef DartDOMWrapperTraits<BindingsClass> Traits; |
200 DartDOMData* domData = DartDOMData::current(); | 200 DartDOMData* domData = DartDOMData::current(); |
201 typename BindingsClass::NativeType* domObject = static_cast<typename Bin dingsClass::NativeType*>(peer); | 201 typename BindingsClass::NativeType* domObject = static_cast<typename Bin dingsClass::NativeType*>(peer); |
202 ASSERT(DartDOMWrapperTraits<BindingsClass>::MapTraits::domMap(domData)-> contains(domObject)); | 202 ASSERT(DartDOMWrapperTraits<BindingsClass>::MapTraits::domMap(domData)-> contains(domObject)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData ->messagePortMap(); } | 281 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData ->messagePortMap(); } |
282 }; | 282 }; |
283 typedef MessagePortMapTraits MapTraits; | 283 typedef MessagePortMapTraits MapTraits; |
284 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; | 284 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; |
285 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr aits; | 285 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr aits; |
286 }; | 286 }; |
287 | 287 |
288 } | 288 } |
289 | 289 |
290 #endif // DartDOMWrapper_h | 290 #endif // DartDOMWrapper_h |
OLD | NEW |