Title: [123014] trunk/Source
Revision
123014
Author
pilg...@chromium.org
Date
2012-07-18 13:51:30 -0700 (Wed, 18 Jul 2012)

Log Message

[Chromium] Call SQLiteFileSystem-related functions directly
https://bugs.webkit.org/show_bug.cgi?id=91631

Reviewed by Adam Barth.

Source/Platform:

Part of a refactoring series. See tracking bug 82948.

* chromium/public/Platform.h:
(Platform):
(WebKit::Platform::databaseOpenFile):
(WebKit::Platform::databaseDeleteFile):
(WebKit::Platform::databaseGetFileAttributes):
(WebKit::Platform::databaseGetFileSize):
(WebKit::Platform::databaseGetSpaceAvailableForOrigin):

Source/WebCore:

Part of a refactoring series. See tracking bug 82948.

* Modules/webdatabase/chromium/QuotaTracker.cpp:
(WebCore::QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin):
* platform/chromium/PlatformSupport.h:
(PlatformSupport):
* platform/sql/chromium/SQLiteFileSystemChromium.cpp:
(WebCore::SQLiteFileSystem::deleteDatabaseFile):
(WebCore::SQLiteFileSystem::getDatabaseFileSize):
* platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:
* platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp:

Source/WebKit/chromium:

Part of a refactoring series. See tracking bug 82948.

* public/platform/WebKitPlatformSupport.h:
(WebKitPlatformSupport):
* src/PlatformSupport.cpp:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (123013 => 123014)


--- trunk/Source/Platform/ChangeLog	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/Platform/ChangeLog	2012-07-18 20:51:30 UTC (rev 123014)
@@ -1,3 +1,20 @@
+2012-07-18  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium] Call SQLiteFileSystem-related functions directly
+        https://bugs.webkit.org/show_bug.cgi?id=91631
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+        
+        * chromium/public/Platform.h:
+        (Platform):
+        (WebKit::Platform::databaseOpenFile):
+        (WebKit::Platform::databaseDeleteFile):
+        (WebKit::Platform::databaseGetFileAttributes):
+        (WebKit::Platform::databaseGetFileSize):
+        (WebKit::Platform::databaseGetSpaceAvailableForOrigin):
+
 2012-07-18  Sailesh Agrawal  <s...@chromium.org>
 
         Chromium Mac: Add TEXTURE_RECTANGLE_ARB support to CCVideoLayerImpl

Modified: trunk/Source/Platform/chromium/public/Platform.h (123013 => 123014)


--- trunk/Source/Platform/chromium/public/Platform.h	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/Platform/chromium/public/Platform.h	2012-07-18 20:51:30 UTC (rev 123014)
@@ -68,6 +68,14 @@
 
 class Platform {
 public:
+    // HTML5 Database ------------------------------------------------------
+
+#ifdef WIN32
+    typedef HANDLE FileHandle;
+#else
+    typedef int FileHandle;
+#endif
+
     WEBKIT_EXPORT static void initialize(Platform*);
     WEBKIT_EXPORT static void shutdown();
     WEBKIT_EXPORT static Platform* current();
@@ -104,6 +112,25 @@
     virtual WebBlobRegistry* blobRegistry() { return 0; }
 
 
+    // Database ------------------------------------------------------------
+
+    // Opens a database file; dirHandle should be 0 if the caller does not need
+    // a handle to the directory containing this file
+    virtual FileHandle databaseOpenFile(const WebString& vfsFileName, int desiredFlags) { return FileHandle(); }
+
+    // Deletes a database file and returns the error code
+    virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; }
+
+    // Returns the attributes of the given database file
+    virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; }
+
+    // Returns the size of the given database file
+    virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; }
+
+    // Returns the space available for the given origin
+    virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; }
+
+
     // DOM Storage --------------------------------------------------
 
     // Return a LocalStorage namespace that corresponds to the following path.

Modified: trunk/Source/WebCore/ChangeLog (123013 => 123014)


--- trunk/Source/WebCore/ChangeLog	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/ChangeLog	2012-07-18 20:51:30 UTC (rev 123014)
@@ -1,3 +1,22 @@
+2012-07-18  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium] Call SQLiteFileSystem-related functions directly
+        https://bugs.webkit.org/show_bug.cgi?id=91631
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * Modules/webdatabase/chromium/QuotaTracker.cpp:
+        (WebCore::QuotaTracker::getDatabaseSizeAndSpaceAvailableToOrigin):
+        * platform/chromium/PlatformSupport.h:
+        (PlatformSupport):
+        * platform/sql/chromium/SQLiteFileSystemChromium.cpp:
+        (WebCore::SQLiteFileSystem::deleteDatabaseFile):
+        (WebCore::SQLiteFileSystem::getDatabaseFileSize):
+        * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:
+        * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp:
+
 2012-07-18  Oliver Hunt  <oli...@apple.com>
 
         WebKit provides APIs that make it possible for JSC to attempt to initialise the heap without initialising threading

Modified: trunk/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp (123013 => 123014)


--- trunk/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/Modules/webdatabase/chromium/QuotaTracker.cpp	2012-07-18 20:51:30 UTC (rev 123014)
@@ -30,10 +30,10 @@
 
 #include "config.h"
 #include "QuotaTracker.h"
-#include "PlatformSupport.h"
 
 #if ENABLE(SQL_DATABASE)
 
+#include <public/Platform.h>
 #include <wtf/StdLibExtras.h>
 
 namespace WebCore {
@@ -48,7 +48,7 @@
     const String& originIdentifier, const String& databaseName,
     unsigned long long* databaseSize, unsigned long long* spaceAvailable)
 {
-    // Extra scope to unlock prior to potentially calling PlatformSupport.
+    // Extra scope to unlock prior to potentially calling WebKit::Platform.
     {
         MutexLocker lockData(m_dataGuard);
         ASSERT(m_databaseSizes.contains(originIdentifier));
@@ -63,7 +63,7 @@
     }
 
     // The embedder hasn't pushed this value to us, so we pull it as needed.
-    *spaceAvailable = PlatformSupport::databaseGetSpaceAvailableForOrigin(originIdentifier);
+    *spaceAvailable = WebKit::Platform::current()->databaseGetSpaceAvailableForOrigin(originIdentifier);
 }
 
 void QuotaTracker::updateDatabaseSize(

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (123013 => 123014)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-07-18 20:51:30 UTC (rev 123014)
@@ -117,18 +117,6 @@
     // Forms --------------------------------------------------------------
     static void notifyFormStateChanged(const Document*);
 
-    // Databases ----------------------------------------------------------
-    // Returns a handle to the DB file and ooptionally a handle to its containing directory
-    static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags);
-    // Returns a SQLite code (SQLITE_OK = 0, on success)
-    static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false);
-    // Returns the attributes of the DB file
-    static long databaseGetFileAttributes(const String& vfsFileName);
-    // Returns the size of the DB file
-    static long long databaseGetFileSize(const String& vfsFileName);
-    // Returns the space available for the origin
-    static long long databaseGetSpaceAvailableForOrigin(const String& originIdentifier);
-
     // IndexedDB ----------------------------------------------------------
     static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
     // Extracts keyPath from values and returns the corresponding keys.

Modified: trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp (123013 => 123014)


--- trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp	2012-07-18 20:51:30 UTC (rev 123014)
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "SQLiteFileSystem.h"
 
-#include "PlatformSupport.h"
 #include "SQLiteDatabase.h"
+#include <public/Platform.h>
 #include <sqlite3.h>
 #include <wtf/text/CString.h>
 
@@ -92,12 +92,12 @@
 
 bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName)
 {
-    return (PlatformSupport::databaseDeleteFile(fileName) == SQLITE_OK);
+    return (WebKit::Platform::current()->databaseDeleteFile(fileName, false) == SQLITE_OK);
 }
 
 long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName)
 {
-    return PlatformSupport::databaseGetFileSize(fileName);
+    return WebKit::Platform::current()->databaseGetFileSize(fileName);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp (123013 => 123014)


--- trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp	2012-07-18 20:51:30 UTC (rev 123014)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "SQLiteFileSystem.h"
 
-#include "PlatformSupport.h"
+#include <public/Platform.h>
 #include <sqlite3.h>
 
 #include <fcntl.h>
@@ -69,10 +69,10 @@
         return result;
 
     if (fd < 0) {
-        fd = PlatformSupport::databaseOpenFile(fileName, desiredFlags);
+        fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
         if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) {
             int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY;
-            fd = PlatformSupport::databaseOpenFile(fileName, newFlags);
+            fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), newFlags);
         }
     }
     if (fd < 0) {
@@ -103,7 +103,7 @@
 //           should be synched after the file is deleted.
 int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir)
 {
-    return PlatformSupport::databaseDeleteFile(fileName, syncDir);
+    return WebKit::Platform::current()->databaseDeleteFile(String(fileName), syncDir);
 }
 
 // Check the existance and status of the given file.
@@ -114,7 +114,7 @@
 // res - the result.
 int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
 {
-    int attr = static_cast<int>(PlatformSupport::databaseGetFileAttributes(fileName));
+    int attr = static_cast<int>(WebKit::Platform::current()->databaseGetFileAttributes(String(fileName)));
     if (attr < 0) {
         *res = 0;
         return SQLITE_OK;

Modified: trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp (123013 => 123014)


--- trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp	2012-07-18 20:51:30 UTC (rev 123014)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "SQLiteFileSystem.h"
 
-#include "PlatformSupport.h"
+#include <public/Platform.h>
 #include <sqlite3.h>
 #include <windows.h>
 
@@ -55,7 +55,7 @@
 int chromiumOpen(sqlite3_vfs*, const char* fileName,
                  sqlite3_file* id, int desiredFlags, int* usedFlags)
 {
-    HANDLE h = PlatformSupport::databaseOpenFile(fileName, desiredFlags);
+    HANDLE h = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
     if (h == INVALID_HANDLE_VALUE) {
         if (desiredFlags & SQLITE_OPEN_READWRITE) {
             int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE;
@@ -82,7 +82,7 @@
 //           should be synched after the file is deleted.
 int chromiumDelete(sqlite3_vfs*, const char* fileName, int)
 {
-    return PlatformSupport::databaseDeleteFile(fileName);
+    return WebKit::Platform::current()->databaseDeleteFile(String(fileName));
 }
 
 // Check the existance and status of the given file.
@@ -93,7 +93,7 @@
 // res - the result.
 int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
 {
-    DWORD attr = PlatformSupport::databaseGetFileAttributes(fileName);
+    DWORD attr = WebKit::Platform::current()->databaseGetFileAttributes(String(fileName));
     switch (flag) {
     case SQLITE_ACCESS_READ:
     case SQLITE_ACCESS_EXISTS:

Modified: trunk/Source/WebKit/chromium/ChangeLog (123013 => 123014)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-18 20:51:30 UTC (rev 123014)
@@ -1,3 +1,17 @@
+2012-07-18  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium] Call SQLiteFileSystem-related functions directly
+        https://bugs.webkit.org/show_bug.cgi?id=91631
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * public/platform/WebKitPlatformSupport.h:
+        (WebKitPlatformSupport):
+        * src/PlatformSupport.cpp:
+        (WebCore):
+
 2012-07-18  Tony Chang  <t...@chromium.org>
 
         [chromium] Unreviewed, more compile fixes on Chromium Win.

Modified: trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h (123013 => 123014)


--- trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-07-18 20:51:30 UTC (rev 123014)
@@ -57,31 +57,6 @@
 // FIXME: Eventually all these API will need to move to WebKit::Platform.
 class WebKitPlatformSupport : public Platform {
 public:
-    // HTML5 Database ------------------------------------------------------
-
-#ifdef WIN32
-    typedef HANDLE FileHandle;
-#else
-    typedef int FileHandle;
-#endif
-
-    // Opens a database file; dirHandle should be 0 if the caller does not need
-    // a handle to the directory containing this file
-    virtual FileHandle databaseOpenFile(
-        const WebString& vfsFileName, int desiredFlags) { return FileHandle(); }
-
-    // Deletes a database file and returns the error code
-    virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; }
-
-    // Returns the attributes of the given database file
-    virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; }
-
-    // Returns the size of the given database file
-    virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; }
-
-    // Returns the space available for the given origin
-    virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; }
-
     // Indexed Database ----------------------------------------------------
 
     virtual WebIDBFactory* idbFactory() { return 0; }

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (123013 => 123014)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-07-18 20:43:40 UTC (rev 123013)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-07-18 20:51:30 UTC (rev 123014)
@@ -276,33 +276,6 @@
 }
 #endif
 
-// Databases ------------------------------------------------------------------
-
-PlatformFileHandle PlatformSupport::databaseOpenFile(const String& vfsFileName, int desiredFlags)
-{
-    return webKitPlatformSupport()->databaseOpenFile(WebString(vfsFileName), desiredFlags);
-}
-
-int PlatformSupport::databaseDeleteFile(const String& vfsFileName, bool syncDir)
-{
-    return webKitPlatformSupport()->databaseDeleteFile(WebString(vfsFileName), syncDir);
-}
-
-long PlatformSupport::databaseGetFileAttributes(const String& vfsFileName)
-{
-    return webKitPlatformSupport()->databaseGetFileAttributes(WebString(vfsFileName));
-}
-
-long long PlatformSupport::databaseGetFileSize(const String& vfsFileName)
-{
-    return webKitPlatformSupport()->databaseGetFileSize(WebString(vfsFileName));
-}
-
-long long PlatformSupport::databaseGetSpaceAvailableForOrigin(const String& originIdentifier)
-{
-    return webKitPlatformSupport()->databaseGetSpaceAvailableForOrigin(originIdentifier);
-}
-
 // Indexed Database -----------------------------------------------------------
 
 PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to