Title: [105483] trunk/Source
Revision
105483
Author
[email protected]
Date
2012-01-19 22:39:21 -0800 (Thu, 19 Jan 2012)

Log Message

Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline
https://bugs.webkit.org/show_bug.cgi?id=76625

Reviewed by David Levin.

Source/WebCore:

No new tests as this patch has no functional changes.

* fileapi/BlobURL.cpp:
(WebCore::BlobURL::getIdentifier):
(WebCore::BlobURL::createBlobURL):
* fileapi/BlobURL.h:
* fileapi/FileWriter.cpp:
(WebCore::FileWriter::write):
(WebCore::FileWriter::truncate):
* platform/AsyncFileSystem.cpp:
(WebCore::AsyncFileSystem::crackFileSystemURL):
(WebCore::AsyncFileSystem::toURL):
(WebCore::AsyncFileSystem::isAvailable):
* platform/AsyncFileSystem.h:

Source/WebKit/chromium:

Also removing (almost) duplicated implementation of AsyncFileSystem::crackFileSystem.

* src/AsyncFileSystemChromium.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105482 => 105483)


--- trunk/Source/WebCore/ChangeLog	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/ChangeLog	2012-01-20 06:39:21 UTC (rev 105483)
@@ -1,3 +1,25 @@
+2012-01-19  Kinuko Yasuda  <[email protected]>
+
+        Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline
+        https://bugs.webkit.org/show_bug.cgi?id=76625
+
+        Reviewed by David Levin.
+
+        No new tests as this patch has no functional changes.
+
+        * fileapi/BlobURL.cpp:
+        (WebCore::BlobURL::getIdentifier):
+        (WebCore::BlobURL::createBlobURL):
+        * fileapi/BlobURL.h:
+        * fileapi/FileWriter.cpp:
+        (WebCore::FileWriter::write):
+        (WebCore::FileWriter::truncate):
+        * platform/AsyncFileSystem.cpp:
+        (WebCore::AsyncFileSystem::crackFileSystemURL):
+        (WebCore::AsyncFileSystem::toURL):
+        (WebCore::AsyncFileSystem::isAvailable):
+        * platform/AsyncFileSystem.h:
+
 2012-01-18  Sam Weinig  <[email protected]>
 
         Move RunLoop to WebCore/platform

Modified: trunk/Source/WebCore/fileapi/BlobURL.cpp (105482 => 105483)


--- trunk/Source/WebCore/fileapi/BlobURL.cpp	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/fileapi/BlobURL.cpp	2012-01-20 06:39:21 UTC (rev 105483)
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-const char BlobURL::kBlobProtocol[] = "blob";
+static const char blobProtocol[] = "blob";
 
 KURL BlobURL::createPublicURL(SecurityOrigin* securityOrigin)
 {
@@ -54,7 +54,7 @@
 
 String BlobURL::getIdentifier(const KURL& url)
 {
-    ASSERT(url.protocolIs(kBlobProtocol));
+    ASSERT(url.protocolIs(blobProtocol));
 
     unsigned startIndex = url.pathAfterLastSlash();
     return url.string().substring(startIndex);
@@ -65,7 +65,7 @@
     ASSERT(!originString.isEmpty());
     if (originString == "null")
         return KURL();
-    String urlString = kBlobProtocol;
+    String urlString = blobProtocol;
     urlString += ":";
     urlString += encodeWithURLEscapeSequences(originString);
     urlString += "/";

Modified: trunk/Source/WebCore/fileapi/BlobURL.h (105482 => 105483)


--- trunk/Source/WebCore/fileapi/BlobURL.h	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/fileapi/BlobURL.h	2012-01-20 06:39:21 UTC (rev 105483)
@@ -51,11 +51,9 @@
     static KURL createPublicURL(SecurityOrigin*);
     static KURL createInternalURL();
     static String getIdentifier(const KURL&);
-    static const char* blobProtocol() { return kBlobProtocol; }
 
 private:
     static KURL createBlobURL(const String& originString);
-    static const char kBlobProtocol[];
     BlobURL() { }
 };
 

Modified: trunk/Source/WebCore/fileapi/FileWriter.cpp (105482 => 105483)


--- trunk/Source/WebCore/fileapi/FileWriter.cpp	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/fileapi/FileWriter.cpp	2012-01-20 06:39:21 UTC (rev 105483)
@@ -43,7 +43,7 @@
 
 namespace WebCore {
 
-static const int kMaxRecursionDepth = 3;
+static const int maxRecursionDepth = 3;
 
 FileWriter::FileWriter(ScriptExecutionContext* context)
     : ActiveDOMObject(context, this)
@@ -103,7 +103,7 @@
         setError(FileError::TYPE_MISMATCH_ERR, ec);
         return;
     }
-    if (m_recursionDepth > kMaxRecursionDepth) {
+    if (m_recursionDepth > maxRecursionDepth) {
         setError(FileError::SECURITY_ERR, ec);
         return;
     }
@@ -141,7 +141,7 @@
         setError(FileError::INVALID_STATE_ERR, ec);
         return;
     }
-    if (m_recursionDepth > kMaxRecursionDepth) {
+    if (m_recursionDepth > maxRecursionDepth) {
         setError(FileError::SECURITY_ERR, ec);
         return;
     }

Modified: trunk/Source/WebCore/platform/AsyncFileSystem.cpp (105482 => 105483)


--- trunk/Source/WebCore/platform/AsyncFileSystem.cpp	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/platform/AsyncFileSystem.cpp	2012-01-20 06:39:21 UTC (rev 105483)
@@ -40,11 +40,38 @@
 
 namespace WebCore {
 
-const char AsyncFileSystem::kPersistentPathPrefix[] = "persistent";
-const size_t AsyncFileSystem::kPersistentPathPrefixLength = sizeof(AsyncFileSystem::kPersistentPathPrefix) - 1;
-const char AsyncFileSystem::kTemporaryPathPrefix[] = "temporary";
-const size_t AsyncFileSystem::kTemporaryPathPrefixLength = sizeof(AsyncFileSystem::kTemporaryPathPrefix) - 1;
+const char AsyncFileSystem::persistentPathPrefix[] = "persistent";
+const size_t AsyncFileSystem::persistentPathPrefixLength = sizeof(AsyncFileSystem::persistentPathPrefix) - 1;
+const char AsyncFileSystem::temporaryPathPrefix[] = "temporary";
+const size_t AsyncFileSystem::temporaryPathPrefixLength = sizeof(AsyncFileSystem::temporaryPathPrefix) - 1;
 
+bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
+{
+    if (!url.protocolIs("filesystem"))
+        return false;
+
+    KURL originURL(ParsedURLString, url.path());
+    String path = decodeURLEscapeSequences(originURL.path());
+    if (path.isEmpty() || path[0] != '/')
+        return false;
+    path = path.substring(1);
+
+    if (path.startsWith(temporaryPathPrefix)) {
+        type = Temporary;
+        path = path.substring(temporaryPathPrefixLength);
+    } else if (path.startsWith(persistentPathPrefix)) {
+        type = Persistent;
+        path = path.substring(persistentPathPrefixLength);
+    } else
+        return false;
+
+    if (path.isEmpty() || path[0] != '/')
+        return false;
+
+    filePath.swap(path);
+    return true;
+}
+
 String AsyncFileSystem::toURL(const String& originString, const String& fullPath)
 {
     StringBuilder result;
@@ -53,10 +80,10 @@
     result.append("/");
     switch (type()) {
     case Temporary:
-        result.append(kTemporaryPathPrefix);
+        result.append(temporaryPathPrefix);
         break;
     case Persistent:
-        result.append(kPersistentPathPrefix);
+        result.append(persistentPathPrefix);
         break;
     }
     result.append(fullPath);
@@ -70,33 +97,6 @@
     return false;
 }
 
-bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
-{
-    if (!url.protocolIs("filesystem"))
-        return false;
-
-    KURL originURL(ParsedURLString, url.path());
-    String path = decodeURLEscapeSequences(originURL.path());
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-    path = path.substring(1);
-
-    if (path.startsWith(kTemporaryPathPrefix)) {
-        type = Temporary;
-        path = path.substring(kTemporaryPathPrefixLength);
-    } else if (path.startsWith(kPersistentPathPrefix)) {
-        type = Persistent;
-        path = path.substring(kPersistentPathPrefixLength);
-    } else
-        return false;
-
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-
-    filePath.swap(path);
-    return true;
-}
-
 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type, const String&)
 {
     notImplemented();

Modified: trunk/Source/WebCore/platform/AsyncFileSystem.h (105482 => 105483)


--- trunk/Source/WebCore/platform/AsyncFileSystem.h	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebCore/platform/AsyncFileSystem.h	2012-01-20 06:39:21 UTC (rev 105483)
@@ -63,10 +63,10 @@
 
     // Path prefixes that are used in the filesystem URLs (that can be obtained by toURL()).
     // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL
-    static const char kPersistentPathPrefix[];
-    static const size_t kPersistentPathPrefixLength;
-    static const char kTemporaryPathPrefix[];
-    static const size_t kTemporaryPathPrefixLength;
+    static const char persistentPathPrefix[];
+    static const size_t persistentPathPrefixLength;
+    static const char temporaryPathPrefix[];
+    static const size_t temporaryPathPrefixLength;
 
     static bool crackFileSystemURL(const KURL&, AsyncFileSystem::Type&, String& filePath);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (105482 => 105483)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-01-20 06:39:21 UTC (rev 105483)
@@ -1,3 +1,14 @@
+2012-01-19  Kinuko Yasuda  <[email protected]>
+
+        Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline
+        https://bugs.webkit.org/show_bug.cgi?id=76625
+
+        Reviewed by David Levin.
+
+        Also removing (almost) duplicated implementation of AsyncFileSystem::crackFileSystem.
+
+        * src/AsyncFileSystemChromium.cpp:
+
 2012-01-19  Alexandre Elias  <[email protected]>
 
         [chromium] Draw gutter quads outside root content layer

Modified: trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp (105482 => 105483)


--- trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp	2012-01-20 05:25:53 UTC (rev 105482)
+++ trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp	2012-01-20 06:39:21 UTC (rev 105483)
@@ -48,8 +48,8 @@
 namespace {
 
 // Chrome-specific FileSystem type.
-const char kExternalPathPrefix[] = "external";
-const size_t kExternalPathPrefixLength = sizeof(kExternalPathPrefix) - 1;
+const char externalPathPrefix[] = "external";
+const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
 
 }
 
@@ -58,36 +58,6 @@
     return true;
 }
 
-bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
-{
-    if (!url.protocolIs("filesystem"))
-        return false;
-
-    KURL originURL(ParsedURLString, url.path());
-    String path = decodeURLEscapeSequences(originURL.path());
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-    path = path.substring(1);
-
-    if (path.startsWith(kTemporaryPathPrefix)) {
-        type = Temporary;
-        path = path.substring(kTemporaryPathPrefixLength);
-    } else if (path.startsWith(kPersistentPathPrefix)) {
-        type = Persistent;
-        path = path.substring(kPersistentPathPrefixLength);
-    } else if (path.startsWith(kExternalPathPrefix)) {
-        type = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
-        path = path.substring(kExternalPathPrefixLength);
-    } else
-        return false;
-
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-
-    filePath.swap(path);
-    return true;
-}
-
 AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL)
     : AsyncFileSystem(type)
     , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to