Title: [88846] trunk/Source/WebKit2
Revision
88846
Author
[email protected]
Date
2011-06-14 13:20:55 -0700 (Tue, 14 Jun 2011)

Log Message

2011-06-14  Anders Carlsson  <[email protected]>

        Reviewed by Sam Weinig.

        Move string ArgumentCoder template specializations out into a .cpp file
        https://bugs.webkit.org/show_bug.cgi?id=62660

        * GNUmakefile.am:
        * Platform/CoreIPC/ArgumentCoders.cpp: Added.
        (CoreIPC::::encode):
        (CoreIPC::::decode):
        * Platform/CoreIPC/ArgumentCoders.h:
        * WebKit2.pro:
        * WebKit2.xcodeproj/project.pbxproj:
        * win/WebKit2.vcproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (88845 => 88846)


--- trunk/Source/WebKit2/ChangeLog	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-14 20:20:55 UTC (rev 88846)
@@ -2,6 +2,22 @@
 
         Reviewed by Sam Weinig.
 
+        Move string ArgumentCoder template specializations out into a .cpp file
+        https://bugs.webkit.org/show_bug.cgi?id=62660
+
+        * GNUmakefile.am:
+        * Platform/CoreIPC/ArgumentCoders.cpp: Added.
+        (CoreIPC::::encode):
+        (CoreIPC::::decode):
+        * Platform/CoreIPC/ArgumentCoders.h:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+
+2011-06-14  Anders Carlsson  <[email protected]>
+
+        Reviewed by Sam Weinig.
+
         Remove PluginInfoStore::Plugin typedef
         https://bugs.webkit.org/show_bug.cgi?id=62657
 

Modified: trunk/Source/WebKit2/GNUmakefile.am (88845 => 88846)


--- trunk/Source/WebKit2/GNUmakefile.am	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/GNUmakefile.am	2011-06-14 20:20:55 UTC (rev 88846)
@@ -76,6 +76,7 @@
 	Source/WebKit/gtk/webkit/webkiterror.h \
 	Source/WebKit/gtk/webkit/webkiterror.cpp \
 	Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h \
+	Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp \
 	Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h \
 	Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp \
 	Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h \

Added: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp (0 => 88846)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp	2011-06-14 20:20:55 UTC (rev 88846)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ArgumentCoders.h"
+
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace CoreIPC {
+
+void ArgumentCoder<AtomicString>::encode(ArgumentEncoder* encoder, const AtomicString& atomicString)
+{
+    encoder->encode(atomicString.string());
+}
+
+bool ArgumentCoder<AtomicString>::decode(ArgumentDecoder* decoder, AtomicString& atomicString)
+{
+    String string;
+    if (!decoder->decode(string))
+        return false;
+
+    atomicString = string;
+    return true;
+}
+
+void ArgumentCoder<CString>::encode(ArgumentEncoder* encoder, const CString& string)
+{
+    // Special case the null string.
+    if (string.isNull()) {
+        encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
+        return;
+    }
+
+    uint32_t length = string.length();
+    encoder->encode(length);
+    encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.data()), length);
+}
+
+bool ArgumentCoder<CString>::decode(ArgumentDecoder* decoder, CString& result)
+{
+    uint32_t length;
+    if (!decoder->decode(length))
+        return false;
+
+    if (length == std::numeric_limits<uint32_t>::max()) {
+        // This is the null string.
+        result = CString();
+        return true;
+    }
+
+    // Before allocating the string, make sure that the decoder buffer is big enough.
+    if (!decoder->bufferIsLargeEnoughToContain<char>(length)) {
+        decoder->markInvalid();
+        return false;
+    }
+
+    char* buffer;
+    CString string = CString::newUninitialized(length, buffer);
+    if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length))
+        return false;
+
+    result = string;
+    return true;
+}
+
+
+void ArgumentCoder<String>::encode(ArgumentEncoder* encoder, const String& string)
+{
+    // Special case the null string.
+    if (string.isNull()) {
+        encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
+        return;
+    }
+
+    uint32_t length = string.length();
+    encoder->encode(length);
+    encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.characters()), length * sizeof(UChar));
+}
+
+bool ArgumentCoder<String>::decode(ArgumentDecoder* decoder, String& result)
+{
+    uint32_t length;
+    if (!decoder->decode(length))
+        return false;
+
+    if (length == std::numeric_limits<uint32_t>::max()) {
+        // This is the null string.
+        result = String();
+        return true;
+    }
+
+    // Before allocating the string, make sure that the decoder buffer is big enough.
+    if (!decoder->bufferIsLargeEnoughToContain<UChar>(length)) {
+        decoder->markInvalid();
+        return false;
+    }
+    
+    UChar* buffer;
+    String string = String::createUninitialized(length, buffer);
+    if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar)))
+        return false;
+    
+    result = string;
+    return true;
+}
+
+} // namespace CoreIPC

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h (88845 => 88846)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h	2011-06-14 20:20:55 UTC (rev 88846)
@@ -29,12 +29,10 @@
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include <utility>
+#include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/TypeTraits.h>
 #include <wtf/Vector.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
 
 namespace CoreIPC {
 
@@ -195,107 +193,21 @@
     }
 };
 
-template<> struct ArgumentCoder<CString> {
-    static void encode(ArgumentEncoder* encoder, const CString& string)
-    {
-        // Special case the null string.
-        if (string.isNull()) {
-            encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
-            return;
-        }
+template<> struct ArgumentCoder<AtomicString> {
+    static void encode(ArgumentEncoder*, const AtomicString&);
+    static bool decode(ArgumentDecoder*, AtomicString&);
+};
 
-        uint32_t length = string.length();
-        encoder->encode(length);
-        encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.data()), length);
-    }
-
-    static bool decode(ArgumentDecoder* decoder, CString& result)
-    {
-        uint32_t length;
-        if (!decoder->decode(length))
-            return false;
-
-        if (length == std::numeric_limits<uint32_t>::max()) {
-            // This is the null string.
-            result = CString();
-            return true;
-        }
-
-        // Before allocating the string, make sure that the decoder buffer is big enough.
-        if (!decoder->bufferIsLargeEnoughToContain<char>(length)) {
-            decoder->markInvalid();
-            return false;
-        }
-
-        char* buffer;
-        CString string = CString::newUninitialized(length, buffer);
-        if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length))
-            return false;
-
-        result = string;
-        return true;
-    }
+template<> struct ArgumentCoder<CString> {
+    static void encode(ArgumentEncoder*, const CString&);
+    static bool decode(ArgumentDecoder*, CString&);
 };
 
 template<> struct ArgumentCoder<String> {
-    static void encode(ArgumentEncoder* encoder, const String& string)
-    {
-        // Special case the null string.
-        if (string.isNull()) {
-            encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
-            return;
-        }
-
-        uint32_t length = string.length();
-        encoder->encode(length);
-        encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.characters()), length * sizeof(UChar));
-    }
-    
-    static bool decode(ArgumentDecoder* decoder, String& result)
-    {
-        uint32_t length;
-        if (!decoder->decode(length))
-            return false;
-
-        if (length == std::numeric_limits<uint32_t>::max()) {
-            // This is the null string.
-            result = String();
-            return true;
-        }
-
-        // Before allocating the string, make sure that the decoder buffer is big enough.
-        if (!decoder->bufferIsLargeEnoughToContain<UChar>(length)) {
-            decoder->markInvalid();
-            return false;
-        }
-        
-        UChar* buffer;
-        String string = String::createUninitialized(length, buffer);
-        if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar)))
-            return false;
-        
-        result = string;
-        return true;
-    }
+    static void encode(ArgumentEncoder*, const String&);
+    static bool decode(ArgumentDecoder*, String&);
 };
 
-template<> struct ArgumentCoder<AtomicString> {
-    static void encode(ArgumentEncoder* encoder, const AtomicString& atomicString)
-    {
-        encoder->encode(atomicString.string());
-    }
-
-    static bool decode(ArgumentDecoder* decoder, AtomicString& atomicString)
-    {
-        String string;
-        if (!decoder->decode(string))
-            return false;
-
-        atomicString = string;
-        return true;
-    }
-};
-
 } // namespace CoreIPC
 
 #endif // SimpleArgumentCoder_h

Modified: trunk/Source/WebKit2/WebKit2.pro (88845 => 88846)


--- trunk/Source/WebKit2/WebKit2.pro	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/WebKit2.pro	2011-06-14 20:20:55 UTC (rev 88846)
@@ -303,6 +303,7 @@
     $$WEBKIT2_GENERATED_HEADERS
 
 SOURCES += \
+    Platform/CoreIPC/ArgumentCoders.cpp \
     Platform/CoreIPC/ArgumentDecoder.cpp \
     Platform/CoreIPC/ArgumentEncoder.cpp \
     Platform/CoreIPC/Attachment.cpp \

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (88845 => 88846)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-06-14 20:20:55 UTC (rev 88846)
@@ -102,6 +102,7 @@
 		1A3979F71332983F00E00300 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; };
 		1A3D610113A7CC2A00F95D4E /* PluginModuleInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */; };
 		1A3D610213A7CC2A00F95D4E /* PluginModuleInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */; };
+		1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */; };
 		1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */; };
 		1A3DD202125E5A1F004515E6 /* WebFindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD201125E5A1F004515E6 /* WebFindClient.h */; };
 		1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD205125E5A2F004515E6 /* APIClient.h */; };
@@ -1010,6 +1011,7 @@
 		1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
 		1A3D60FF13A7CC2A00F95D4E /* PluginModuleInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginModuleInfo.cpp; sourceTree = "<group>"; };
 		1A3D610013A7CC2A00F95D4E /* PluginModuleInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginModuleInfo.h; sourceTree = "<group>"; };
+		1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentCoders.cpp; sourceTree = "<group>"; };
 		1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindClient.cpp; sourceTree = "<group>"; };
 		1A3DD201125E5A1F004515E6 /* WebFindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFindClient.h; sourceTree = "<group>"; };
 		1A3DD205125E5A2F004515E6 /* APIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = "<group>"; };
@@ -2282,6 +2284,7 @@
 			children = (
 				BCC56F751159955E001CCAF9 /* mac */,
 				1AEFD27811D16C81008219D3 /* ArgumentCoder.h */,
+				1A3D610413A7F03A00F95D4E /* ArgumentCoders.cpp */,
 				1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */,
 				BC032D9D10F437D10058C15A /* ArgumentDecoder.cpp */,
 				BC032D9E10F437D10058C15A /* ArgumentDecoder.h */,
@@ -4493,6 +4496,7 @@
 				512DF70A138C26C700A22FC6 /* KeychainAttribute.cpp in Sources */,
 				93C01DAD139AC91700ED51D7 /* CoreIPCClientRunLoop.mm in Sources */,
 				1A3D610113A7CC2A00F95D4E /* PluginModuleInfo.cpp in Sources */,
+				1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebKit2/win/WebKit2.vcproj (88845 => 88846)


--- trunk/Source/WebKit2/win/WebKit2.vcproj	2011-06-14 20:09:49 UTC (rev 88845)
+++ trunk/Source/WebKit2/win/WebKit2.vcproj	2011-06-14 20:20:55 UTC (rev 88846)
@@ -3738,6 +3738,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Platform\CoreIPC\ArgumentCoders.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\Platform\CoreIPC\ArgumentCoders.h"
 					>
 				</File>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to