#include "config.h"
#include "modules/filesystem/EntrySync.h"
-#include "bindings/v8/ExceptionMessages.h"
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionMessages.h"
+#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "modules/filesystem/DOMFilePath.h"
-#include "modules/filesystem/DOMFileSystemSync.h"
#include "modules/filesystem/DirectoryEntry.h"
#include "modules/filesystem/DirectoryEntrySync.h"
#include "modules/filesystem/FileEntrySync.h"
#include "modules/filesystem/Metadata.h"
#include "modules/filesystem/SyncCallbackHelper.h"
-namespace WebCore {
+namespace blink {
-PassRefPtr<EntrySync> EntrySync::create(EntryBase* entry)
+EntrySync* EntrySync::create(EntryBase* entry)
{
if (entry->isFile())
- return adoptRef(new FileEntrySync(entry->m_fileSystem, entry->m_fullPath));
- return adoptRef(new DirectoryEntrySync(entry->m_fileSystem, entry->m_fullPath));
+ return FileEntrySync::create(entry->m_fileSystem, entry->m_fullPath);
+ return DirectoryEntrySync::create(entry->m_fileSystem, entry->m_fullPath);
}
-PassRefPtr<Metadata> EntrySync::getMetadata(ExceptionState& es)
+Metadata* EntrySync::getMetadata(ExceptionState& exceptionState)
{
- MetadataSyncCallbackHelper helper;
- if (!m_fileSystem->getMetadata(this, helper.successCallback(), helper.errorCallback(), DOMFileSystemBase::Synchronous)) {
- es.throwDOMException(InvalidModificationError, ExceptionMessages::failedToExecute("getMetadata", "EntrySync"));
- return 0;
- }
- return helper.getResult(es);
+ MetadataSyncCallbackHelper* helper = MetadataSyncCallbackHelper::create();
+ m_fileSystem->getMetadata(this, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);
+ return helper->getResult(exceptionState);
}
-PassRefPtr<EntrySync> EntrySync::moveTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionState& es) const
+EntrySync* EntrySync::moveTo(DirectoryEntrySync* parent, const String& name, ExceptionState& exceptionState) const
{
- EntrySyncCallbackHelper helper;
- if (!m_fileSystem->move(this, parent.get(), name, helper.successCallback(), helper.errorCallback(), DOMFileSystemBase::Synchronous)) {
- es.throwDOMException(InvalidModificationError, ExceptionMessages::failedToExecute("moveTo", "EntrySync"));
- return 0;
- }
- return helper.getResult(es);
+ EntrySyncCallbackHelper* helper = EntrySyncCallbackHelper::create();
+ m_fileSystem->move(this, parent, name, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);
+ return helper->getResult(exceptionState);
}
-PassRefPtr<EntrySync> EntrySync::copyTo(PassRefPtr<DirectoryEntrySync> parent, const String& name, ExceptionState& es) const
+EntrySync* EntrySync::copyTo(DirectoryEntrySync* parent, const String& name, ExceptionState& exceptionState) const
{
- EntrySyncCallbackHelper helper;
- if (!m_fileSystem->copy(this, parent.get(), name, helper.successCallback(), helper.errorCallback(), DOMFileSystemBase::Synchronous)) {
- es.throwDOMException(InvalidModificationError, ExceptionMessages::failedToExecute("copyTo", "EntrySync"));
- return 0;
- }
- return helper.getResult(es);
+ EntrySyncCallbackHelper* helper = EntrySyncCallbackHelper::create();
+ m_fileSystem->copy(this, parent, name, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);
+ return helper->getResult(exceptionState);
}
-void EntrySync::remove(ExceptionState& es) const
+void EntrySync::remove(ExceptionState& exceptionState) const
{
- VoidSyncCallbackHelper helper;
- if (!m_fileSystem->remove(this, helper.successCallback(), helper.errorCallback(), DOMFileSystemBase::Synchronous)) {
- es.throwDOMException(InvalidModificationError, ExceptionMessages::failedToExecute("remove", "EntrySync"));
- return;
- }
- helper.getResult(es);
+ VoidSyncCallbackHelper* helper = VoidSyncCallbackHelper::create();
+ m_fileSystem->remove(this, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);
+ helper->getResult(exceptionState);
}
-PassRefPtr<EntrySync> EntrySync::getParent() const
+EntrySync* EntrySync::getParent() const
{
// Sync verion of getParent doesn't throw exceptions.
String parentPath = DOMFilePath::getDirectory(fullPath());
return DirectoryEntrySync::create(m_fileSystem, parentPath);
}
-EntrySync::EntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& fullPath)
+EntrySync::EntrySync(DOMFileSystemBase* fileSystem, const String& fullPath)
: EntryBase(fileSystem, fullPath)
{
- ScriptWrappable::init(this);
+}
+
+void EntrySync::trace(Visitor* visitor)
+{
+ EntryBase::trace(visitor);
}
}