Title: [119024] trunk/Source
Revision
119024
Author
pilg...@chromium.org
Date
2012-05-30 19:31:36 -0700 (Wed, 30 May 2012)

Log Message

[Chromium] Call fileUtilities methods directly
https://bugs.webkit.org/show_bug.cgi?id=87852

Reviewed by Adam Barth.

Part of a refactoring series. See tracking bug 82948.

Source/WebCore:

* platform/chromium/DragDataChromium.cpp:
(WebCore::DragData::asURL):
* platform/chromium/FileSystemChromium.cpp:
(WebCore::deleteFile):
(WebCore::deleteEmptyDirectory):
(WebCore::getFileSize):
(WebCore::getFileModificationTime):
(WebCore::getFileMetadata):
(WebCore::directoryName):
(WebCore::pathByAppendingComponent):
(WebCore::makeAllDirectories):
(WebCore::openFile):
(WebCore::closeFile):
(WebCore::seekFile):
(WebCore::truncateFile):
(WebCore::readFromFile):
(WebCore::writeToFile):
* platform/chromium/PlatformSupport.h:
(PlatformSupport):

Source/WebKit/chromium:

* src/PlatformSupport.cpp:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119023 => 119024)


--- trunk/Source/WebCore/ChangeLog	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebCore/ChangeLog	2012-05-31 02:31:36 UTC (rev 119024)
@@ -1,3 +1,32 @@
+2012-05-30  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium] Call fileUtilities methods directly
+        https://bugs.webkit.org/show_bug.cgi?id=87852
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * platform/chromium/DragDataChromium.cpp:
+        (WebCore::DragData::asURL):
+        * platform/chromium/FileSystemChromium.cpp:
+        (WebCore::deleteFile):
+        (WebCore::deleteEmptyDirectory):
+        (WebCore::getFileSize):
+        (WebCore::getFileModificationTime):
+        (WebCore::getFileMetadata):
+        (WebCore::directoryName):
+        (WebCore::pathByAppendingComponent):
+        (WebCore::makeAllDirectories):
+        (WebCore::openFile):
+        (WebCore::closeFile):
+        (WebCore::seekFile):
+        (WebCore::truncateFile):
+        (WebCore::readFromFile):
+        (WebCore::writeToFile):
+        * platform/chromium/PlatformSupport.h:
+        (PlatformSupport):
+
 2012-05-30  Kent Tamura  <tk...@chromium.org>
 
         Form controls in <fieldset disabled> should not be focusable.

Modified: trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp (119023 => 119024)


--- trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp	2012-05-31 02:31:36 UTC (rev 119024)
@@ -38,9 +38,11 @@
 #include "KURL.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
-#include "PlatformSupport.h"
 #include "markup.h"
 
+#include <public/Platform.h>
+#include <public/WebFileUtilities.h>
+
 namespace WebCore {
 
 static bool containsHTML(const ChromiumDataObject* dropData)
@@ -60,7 +62,8 @@
     if (m_platformDragData->types().contains(mimeTypeTextURIList))
         m_platformDragData->urlAndTitle(url, title);
     else if (filenamePolicy == ConvertFilenames && containsFiles()) {
-        url = ""
+        String path = String(WebKit::Platform::current()->fileUtilities()->getAbsolutePath(m_platformDragData->filenames()[0]));
+        url = ""
     }
     return url;
 }

Modified: trunk/Source/WebCore/platform/chromium/FileSystemChromium.cpp (119023 => 119024)


--- trunk/Source/WebCore/platform/chromium/FileSystemChromium.cpp	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebCore/platform/chromium/FileSystemChromium.cpp	2012-05-31 02:31:36 UTC (rev 119024)
@@ -34,27 +34,27 @@
 #include "FileMetadata.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
-#include "PlatformSupport.h"
 
 #include <public/Platform.h>
+#include <public/WebFileInfo.h>
 #include <public/WebFileUtilities.h>
 
 namespace WebCore {
 
 bool deleteFile(const String& path)
 {
-    return PlatformSupport::deleteFile(path);
+    return WebKit::Platform::current()->fileUtilities()->deleteFile(path);
 }
 
 bool deleteEmptyDirectory(const String& path)
 {
-    return PlatformSupport::deleteEmptyDirectory(path);
+    return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path);
 }
 
 bool getFileSize(const String& path, long long& result)
 {
     FileMetadata metadata;
-    if (!PlatformSupport::getFileMetadata(path, metadata))
+    if (!getFileMetadata(path, metadata))
         return false;
     result = metadata.length;
     return true;
@@ -63,7 +63,7 @@
 bool getFileModificationTime(const String& path, time_t& result)
 {
     FileMetadata metadata;
-    if (!PlatformSupport::getFileMetadata(path, metadata))
+    if (!getFileMetadata(path, metadata))
         return false;
     result = metadata.modificationTime;
     return true;
@@ -71,22 +71,28 @@
 
 bool getFileMetadata(const String& path, FileMetadata& metadata)
 {
-    return PlatformSupport::getFileMetadata(path, metadata);
+    WebKit::WebFileInfo webFileInfo;
+    if (!WebKit::Platform::current()->fileUtilities()->getFileInfo(path, webFileInfo))
+        return false;
+    metadata.modificationTime = webFileInfo.modificationTime;
+    metadata.length = webFileInfo.length;
+    metadata.type = static_cast<FileMetadata::Type>(webFileInfo.type);
+    return true;
 }
 
 String directoryName(const String& path)
 {
-    return PlatformSupport::directoryName(path);
+    return WebKit::Platform::current()->fileUtilities()->directoryName(path);
 }
 
 String pathByAppendingComponent(const String& path, const String& component)
 {
-    return PlatformSupport::pathByAppendingComponent(path, component);
+    return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component);
 }
 
 bool makeAllDirectories(const String& path)
 {
-    return PlatformSupport::makeAllDirectories(path);
+    return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path);
 }
 
 bool fileExists(const String& path)
@@ -96,32 +102,32 @@
 
 PlatformFileHandle openFile(const String& path, FileOpenMode mode)
 {
-    return PlatformSupport::openFile(path, mode);
+    return WebKit::Platform::current()->fileUtilities()->openFile(path, mode);
 }
 
 void closeFile(PlatformFileHandle& handle)
 {
-    return PlatformSupport::closeFile(handle);
+    WebKit::Platform::current()->fileUtilities()->closeFile(handle);
 }
 
 long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin)
 {
-    return PlatformSupport::seekFile(handle, offset, origin);
+    return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin);
 }
 
 bool truncateFile(PlatformFileHandle handle, long long offset)
 {
-    return PlatformSupport::truncateFile(handle, offset);
+    return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset);
 }
 
 int readFromFile(PlatformFileHandle handle, char* data, int length)
 {
-    return PlatformSupport::readFromFile(handle, data, length);
+    return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length);
 }
 
 int writeToFile(PlatformFileHandle handle, const char* data, int length)
 {
-    return PlatformSupport::writeToFile(handle, data, length);
+    return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length);
 }
 
 Vector<String> listDirectory(const String& path, const String& filter)

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (119023 => 119024)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-05-31 02:31:36 UTC (rev 119024)
@@ -122,23 +122,6 @@
     static void deleteCookie(const Document*, const KURL&, const String& cookieName);
     static bool cookiesEnabled(const Document*);
 
-    // File ---------------------------------------------------------------
-    static bool deleteFile(const String&);
-    static bool deleteEmptyDirectory(const String&);
-    static bool getFileMetadata(const String&, FileMetadata& result);
-    static String directoryName(const String& path);
-    static String pathByAppendingComponent(const String& path, const String& component);
-    static bool makeAllDirectories(const String& path);
-    static String getAbsolutePath(const String&);
-    static bool isDirectory(const String&);
-    static KURL filePathToURL(const String&);
-    static PlatformFileHandle openFile(const String& path, FileOpenMode);
-    static void closeFile(PlatformFileHandle&);
-    static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin);
-    static bool truncateFile(PlatformFileHandle, long long offset);
-    static int readFromFile(PlatformFileHandle, char* data, int length);
-    static int writeToFile(PlatformFileHandle, const char* data, int length);
-
 #if ENABLE(FILE_SYSTEM)
     static PassOwnPtr<AsyncFileSystem> createAsyncFileSystem();
 #endif

Modified: trunk/Source/WebKit/chromium/ChangeLog (119023 => 119024)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-31 02:31:36 UTC (rev 119024)
@@ -1,3 +1,15 @@
+2012-05-30  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium] Call fileUtilities methods directly
+        https://bugs.webkit.org/show_bug.cgi?id=87852
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * src/PlatformSupport.cpp:
+        (WebCore):
+
 2012-05-30  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r118986.

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (119023 => 119024)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-05-31 02:24:22 UTC (rev 119023)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-05-31 02:31:36 UTC (rev 119024)
@@ -302,87 +302,6 @@
 
 // File ------------------------------------------------------------------------
 
-bool PlatformSupport::deleteFile(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->deleteFile(path);
-}
-
-bool PlatformSupport::deleteEmptyDirectory(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path);
-}
-
-bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result)
-{
-    WebFileInfo webFileInfo;
-    if (!webKitPlatformSupport()->fileUtilities()->getFileInfo(path, webFileInfo))
-        return false;
-    result.modificationTime = webFileInfo.modificationTime;
-    result.length = webFileInfo.length;
-    result.type = static_cast<FileMetadata::Type>(webFileInfo.type);
-    return true;
-}
-
-String PlatformSupport::directoryName(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->directoryName(path);
-}
-
-String PlatformSupport::pathByAppendingComponent(const String& path, const String& component)
-{
-    return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component);
-}
-
-bool PlatformSupport::makeAllDirectories(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path);
-}
-
-String PlatformSupport::getAbsolutePath(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->getAbsolutePath(path);
-}
-
-bool PlatformSupport::isDirectory(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->isDirectory(path);
-}
-
-KURL PlatformSupport::filePathToURL(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->filePathToURL(path);
-}
-
-PlatformFileHandle PlatformSupport::openFile(const String& path, FileOpenMode mode)
-{
-    return WebKit::Platform::current()->fileUtilities()->openFile(path, mode);
-}
-
-void PlatformSupport::closeFile(PlatformFileHandle& handle)
-{
-    WebKit::Platform::current()->fileUtilities()->closeFile(handle);
-}
-
-long long PlatformSupport::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin)
-{
-    return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin);
-}
-
-bool PlatformSupport::truncateFile(PlatformFileHandle handle, long long offset)
-{
-    return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset);
-}
-
-int PlatformSupport::readFromFile(PlatformFileHandle handle, char* data, int length)
-{
-    return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length);
-}
-
-int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, int length)
-{
-    return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length);
-}
-
 #if ENABLE(FILE_SYSTEM)
 PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem()
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to