| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 static void returnToDart(Dart_NativeArguments args, PassRefPtr<typename Bind
ingsClass::NativeType> domObject) | 194 static void returnToDart(Dart_NativeArguments args, PassRefPtr<typename Bind
ingsClass::NativeType> domObject) |
| 195 { | 195 { |
| 196 returnToDart<BindingsClass>(args, domObject.get()); | 196 returnToDart<BindingsClass>(args, domObject.get()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 static int wrapperNativeFieldCount() { return kNativeFieldCount; } | 199 static int wrapperNativeFieldCount() { return kNativeFieldCount; } |
| 200 | 200 |
| 201 static Dart_Handle exceptionCodeToDartException(ExceptionCode); | 201 static Dart_Handle exceptionCodeToDartException(ExceptionCode); |
| 202 static Dart_Handle exceptionCodeToDartException(DartExceptionState&); | 202 static Dart_Handle exceptionCodeToDartException(DartExceptionState&); |
| 203 | 203 |
| 204 template <class BindingsClass> |
| 205 static Dart_Handle dartClass() |
| 206 { |
| 207 return dartClass(BindingsClass::dartImplementationClassName, |
| 208 BindingsClass::dartImplementationLibraryName, BindingsClass::dartCla
ssId); |
| 209 } |
| 210 |
| 204 private: | 211 private: |
| 205 enum NativeFieldIndices { | 212 enum NativeFieldIndices { |
| 206 kNativeImplementationIndex = 0, | 213 kNativeImplementationIndex = 0, |
| 207 kNativeFieldCount | 214 kNativeFieldCount |
| 208 }; | 215 }; |
| 209 | 216 |
| 210 static Dart_Handle dartClass(const char* dartImplementationClassName, | 217 static Dart_Handle dartClass(const char* dartImplementationClassName, |
| 211 const char* dartImplementationLibraryName, intptr_t classIndex); | 218 const char* dartImplementationLibraryName, intptr_t classIndex); |
| 212 | 219 |
| 213 template <class BindingsClass> | |
| 214 static Dart_Handle dartClass() | |
| 215 { | |
| 216 return dartClass(BindingsClass::dartImplementationClassName, | |
| 217 BindingsClass::dartImplementationLibraryName, BindingsClass::dartCla
ssId); | |
| 218 } | |
| 219 | |
| 220 static void writeNativePointer(Dart_Handle wrapper, int index, void* pointer
) | 220 static void writeNativePointer(Dart_Handle wrapper, int index, void* pointer
) |
| 221 { | 221 { |
| 222 DartApiScope scope; | 222 DartApiScope scope; |
| 223 Dart_Handle result = Dart_SetNativeInstanceField(wrapper, index, reinter
pret_cast<intptr_t>(pointer)); | 223 Dart_Handle result = Dart_SetNativeInstanceField(wrapper, index, reinter
pret_cast<intptr_t>(pointer)); |
| 224 UNUSED_PARAM(result); | 224 UNUSED_PARAM(result); |
| 225 ASSERT(!Dart_IsError(result)); | 225 ASSERT(!Dart_IsError(result)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 static void* readNativePointer(Dart_Handle wrapper, int index) | 228 static void* readNativePointer(Dart_Handle wrapper, int index) |
| 229 { | 229 { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } | 356 static DartMessagePortMap* domMap(DartDOMData* domData) { return domData
->messagePortMap(); } |
| 357 }; | 357 }; |
| 358 typedef MessagePortMapTraits MapTraits; | 358 typedef MessagePortMapTraits MapTraits; |
| 359 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; | 359 typedef DartDOMWrapperActiveTraits<DartMessagePort, false> ActiveTraits; |
| 360 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr
aits; | 360 typedef DartDOMWrapperEventTargetTraits<DartMessagePort, true> EventTargetTr
aits; |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 } | 363 } |
| 364 | 364 |
| 365 #endif // DartDOMWrapper_h | 365 #endif // DartDOMWrapper_h |
| OLD | NEW |