| Index: Source/bindings/dart/DartDOMWrapper.cpp
|
| diff --git a/Source/bindings/dart/DartDOMWrapper.cpp b/Source/bindings/dart/DartDOMWrapper.cpp
|
| index e26835cefbe34bf556f794747cc6993e17885756..3f51bc5a3e351fbc1f613783666331508f4a63d3 100644
|
| --- a/Source/bindings/dart/DartDOMWrapper.cpp
|
| +++ b/Source/bindings/dart/DartDOMWrapper.cpp
|
| @@ -43,37 +43,29 @@
|
|
|
| namespace WebCore {
|
|
|
| -Dart_Handle DartDOMWrapper::instantiateWrapper(const char* className, const char* libraryName)
|
| +Dart_Handle DartDOMWrapper::dartClass(const char* className, const char* libraryName, intptr_t index)
|
| {
|
| - Dart_Handle library = DartUtilities::libraryForCurrentIsolate(libraryName);
|
| - ASSERT(!Dart_IsError(library));
|
| + ASSERT(index < NumWebkitClassIds);
|
|
|
| - Dart_Handle type = Dart_GetType(library, Dart_NewStringFromCString(className), 0, 0);
|
| - ASSERT(!Dart_IsError(type));
|
| + ClassTable* table = DartDOMData::current()->classHandleCache();
|
|
|
| - Dart_Handle instance = Dart_Allocate(type);
|
| - ASSERT(!Dart_IsError(instance));
|
| + Dart_Handle type;
|
| + Dart_PersistentHandle persistentType = (*table)[index];
|
|
|
| - return instance;
|
| -}
|
| + if (persistentType) {
|
| + type = Dart_HandleFromPersistent(persistentType);
|
| + } else {
|
| + Dart_Handle library = DartUtilities::libraryForCurrentIsolate(libraryName);
|
| + ASSERT(!Dart_IsError(library));
|
|
|
| -bool DartDOMWrapper::instanceOf(const char* className, const char* libraryName, Dart_Handle wrapper)
|
| -{
|
| - // FIXME(rmacnak): Cache classes in the corresponding bindings class. Requires persistent handles.
|
| - Dart_Handle library = DartUtilities::libraryForCurrentIsolate(libraryName);
|
| - ASSERT(!Dart_IsError(library));
|
| -
|
| - Dart_Handle type = Dart_GetType(library, Dart_NewStringFromCString(className), 0, 0);
|
| - ASSERT(!Dart_IsError(type));
|
| - if (Dart_IsError(type))
|
| - return false;
|
| -
|
| - bool isInstanceOf = false;
|
| - Dart_Handle result = Dart_ObjectIsType(wrapper, type, &isInstanceOf);
|
| - ASSERT(!Dart_IsError(result));
|
| - if (Dart_IsError(result))
|
| - return false;
|
| - return isInstanceOf;
|
| + type = Dart_GetType(library, Dart_NewStringFromCString(className), 0, 0);
|
| + ASSERT(!Dart_IsError(type));
|
| +
|
| + persistentType = Dart_NewPersistentHandle(type);
|
| + (*table)[index] = persistentType;
|
| + }
|
| +
|
| + return type;
|
| }
|
|
|
| Dart_Handle DartDOMWrapper::exceptionCodeToDartException(ExceptionCode exceptionCode)
|
|
|