Index: Source/bindings/core/dart/shared_lib/DartNativeExtensionsPosix.cpp |
diff --git a/Source/core/svg/SVGPointTearOff.cpp b/Source/bindings/core/dart/shared_lib/DartNativeExtensionsPosix.cpp |
similarity index 54% |
copy from Source/core/svg/SVGPointTearOff.cpp |
copy to Source/bindings/core/dart/shared_lib/DartNativeExtensionsPosix.cpp |
index 706d26dab6c52256d253def792931381f8ebb77b..9cc1e4c28385daa2e054da55f7215c901f2f109f 100644 |
--- a/Source/core/svg/SVGPointTearOff.cpp |
+++ b/Source/bindings/core/dart/shared_lib/DartNativeExtensionsPosix.cpp |
@@ -29,47 +29,52 @@ |
*/ |
#include "config.h" |
+#include "bindings/core/dart/shared_lib/DartNativeExtensions.h" |
-#include "core/svg/SVGPointTearOff.h" |
+#if defined(ENABLE_DART_NATIVE_EXTENSIONS) |
+#if OS(POSIX) |
+#include "wtf/text/StringUTF8Adaptor.h" |
+#include <dlfcn.h> |
+#include <string> |
-#include "bindings/core/v8/ExceptionState.h" |
-#include "core/dom/ExceptionCode.h" |
-#include "core/svg/SVGElement.h" |
-#include "core/svg/SVGMatrixTearOff.h" |
namespace blink { |
-SVGPointTearOff::SVGPointTearOff(PassRefPtrWillBeRawPtr<SVGPoint> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName) |
- : SVGPropertyTearOff<SVGPoint>(target, contextElement, propertyIsAnimVal, attributeName) |
+Dart_Handle DartNativeExtensions::loadExtensionLibrary(const String& libraryPath, const String& libraryName, void** libraryHandle) |
{ |
-} |
- |
-void SVGPointTearOff::setX(float f, ExceptionState& exceptionState) |
-{ |
- if (isImmutable()) { |
- exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
- return; |
+ String libraryFile = libraryPath; |
+#if OS(MACOSX) |
+ libraryFile.append("lib"); |
+ libraryFile.append(libraryName); |
+ libraryFile.append(".dylib"); |
+#else |
+ libraryFile.append("lib"); |
+ libraryFile.append(libraryName); |
+ libraryFile.append(".so"); |
+#endif |
+ StringUTF8Adaptor utf8LibraryFile(libraryFile); |
+ std::string utf8LibraryFileStr(utf8LibraryFile.data(), utf8LibraryFile.length()); |
+ *libraryHandle = dlopen(utf8LibraryFileStr.c_str(), RTLD_LAZY); |
+ if (!*libraryHandle) { |
+ return Dart_NewApiError(dlerror()); |
} |
- |
- target()->setX(f); |
- commitChange(); |
+ return Dart_Null(); |
} |
-void SVGPointTearOff::setY(float f, ExceptionState& exceptionState) |
+Dart_Handle DartNativeExtensions::resolveSymbol(void* libHandle, const String& symbolName, void** symbol) |
{ |
- if (isImmutable()) { |
- exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
- return; |
+ StringUTF8Adaptor utf8Symbol(symbolName); |
+ std::string utf8SymbolStr(utf8Symbol.data(), utf8Symbol.length()); |
+ dlerror(); |
+ *symbol = dlsym(libHandle, utf8SymbolStr.c_str()); |
+ const char* error = dlerror(); |
+ if (error) { |
+ return Dart_NewApiError(error); |
} |
- |
- target()->setY(f); |
- commitChange(); |
+ return Dart_Null(); |
} |
-PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPointTearOff::matrixTransform(PassRefPtrWillBeRawPtr<SVGMatrixTearOff> matrix) |
-{ |
- FloatPoint point = target()->matrixTransform(matrix->value()); |
- return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnimVal); |
} |
-} |
+#endif // OS(POSIX) |
+#endif // defined(ENABLE_DART_NATIVE_EXTENSIONS) |