Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: Source/bindings/dart/DartNativeExtensionsPosix.cpp

Issue 446733003: Tue Aug 5 16:08:45 PDT 2014 Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/dart/DartNativeExtensions.cpp ('k') | Source/bindings/dart/DartNativeExtensionsWin.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartNativeExtensionsPosix.cpp
diff --git a/Source/core/svg/SVGPointTearOff.cpp b/Source/bindings/dart/DartNativeExtensionsPosix.cpp
similarity index 54%
copy from Source/core/svg/SVGPointTearOff.cpp
copy to Source/bindings/dart/DartNativeExtensionsPosix.cpp
index 2225b4fc775641ba33540604a2bc2ec8deafef71..dec084969549e1fd98a033be2e8c1501f1790f6e 100644
--- a/Source/core/svg/SVGPointTearOff.cpp
+++ b/Source/bindings/dart/DartNativeExtensionsPosix.cpp
@@ -29,47 +29,52 @@
*/
#include "config.h"
+#include "bindings/dart/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/common/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/svg/SVGMatrixTearOff.h"
namespace WebCore {
-SVGPointTearOff::SVGPointTearOff(PassRefPtr<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)
{
- ScriptWrappable::init(this);
-}
-
-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();
}
-PassRefPtr<SVGPointTearOff> SVGPointTearOff::matrixTransform(PassRefPtr<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)
« no previous file with comments | « Source/bindings/dart/DartNativeExtensions.cpp ('k') | Source/bindings/dart/DartNativeExtensionsWin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698