#if ENABLE(TIZEN_FILE_SYSTEM)
bool copyFile(const String& sourcePath, const String& destinationPath);
+bool haveEnoughSpace(const String& path, unsigned requestSize);
bool getDirectorySize(const String& path, long long& size);
bool linkFile(const String& sourcePath, const String& destinationPath);
bool removeDirectory(const String& path);
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <unistd.h>
#include <wtf/text/CString.h>
return !rename(fsRepSource.data(), fsRepDestination.data());
}
+bool haveEnoughSpace(const String& path, unsigned requestSize)
+{
+ struct statvfs buf;
+ if (!statvfs(path.utf8().data(), &buf)) {
+ unsigned long availableSize = buf.f_bavail * buf.f_bsize;
+ if (availableSize > requestSize)
+ return true;
+ }
+ return false;
+}
}
#endif
#include "StorageTracker.h"
#include <wtf/MainThread.h>
+#if ENABLE(TIZEN_WEB_STORAGE)
+#include "FileSystem.h"
+#endif
+
namespace WebCore {
StorageAreaImpl::~StorageAreaImpl()
if (oldValue == value)
return;
+#if ENABLE(TIZEN_WEB_STORAGE)
+ if (!haveEnoughSpace(m_storageSyncManager->fullDatabaseFilename(m_securityOrigin->databaseIdentifier()), key.length() + value.length())) {
+ ec = QUOTA_EXCEEDED_ERR;
+ return;
+ }
+#endif
+
if (m_storageAreaSync)
m_storageAreaSync->scheduleItemForSync(key, value);
StorageEventDispatcher::dispatch(key, oldValue, value, m_storageType, m_securityOrigin.get(), frame);