Changeset 61639 in webkit


Ignore:
Timestamp:
Jun 22, 2010 4:55:28 PM (14 years ago)
Author:
andersca@apple.com
Message:

2010-06-22 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Add a SimpleArgumentCoder class template that works on POD types
https://bugs.webkit.org/show_bug.cgi?id=41023

  • Platform/CoreIPC/SimpleArgumentCoder.h: Added. (CoreIPC::SimpleArgumentCoder::encode): (CoreIPC::SimpleArgumentCoder::decode):
  • Shared/WebCoreTypeArgumentMarshalling.h: (CoreIPC::):
  • WebKit2.xcodeproj/project.pbxproj:
Location:
trunk/WebKit2
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r61635 r61639  
     12010-06-22  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Add a SimpleArgumentCoder class template that works on POD types
     6        https://bugs.webkit.org/show_bug.cgi?id=41023
     7
     8        * Platform/CoreIPC/SimpleArgumentCoder.h: Added.
     9        (CoreIPC::SimpleArgumentCoder::encode):
     10        (CoreIPC::SimpleArgumentCoder::decode):
     11        * Shared/WebCoreTypeArgumentMarshalling.h:
     12        (CoreIPC::):
     13        * WebKit2.xcodeproj/project.pbxproj:
     14
    1152010-06-22  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/WebKit2/Shared/WebCoreTypeArgumentMarshalling.h

    r61635 r61639  
    3030#include "ArgumentEncoder.h"
    3131#include "Arguments.h"
     32#include "SimpleArgumentCoder.h"
    3233#include <WebCore/FloatRect.h>
    3334#include <WebCore/IntRect.h>
     
    3637namespace CoreIPC {
    3738
    38 template<> struct ArgumentCoder<WebCore::IntPoint> {
    39     static void encode(ArgumentEncoder* encoder, const WebCore::IntPoint& p)
    40     {
    41         encoder->encode(CoreIPC::In(p.x(), p.y()));
    42     };
    43 
    44     static bool decode(ArgumentDecoder* decoder, WebCore::IntPoint& p)
    45     {
    46         int x;
    47         int y;
    48         if (!decoder->decode(CoreIPC::Out(x, y)))
    49             return false;
    50        
    51         p.setX(x);
    52         p.setY(y);
    53         return true;
    54     }
    55 };
    56 
    57 template<> struct ArgumentCoder<WebCore::IntSize> {
    58     static void encode(ArgumentEncoder* encoder, const WebCore::IntSize& s)
    59     {
    60         encoder->encode(CoreIPC::In(s.width(), s.height()));
    61     };
    62    
    63     static bool decode(ArgumentDecoder* decoder, WebCore::IntSize& s)
    64     {
    65         int width;
    66         int height;
    67         if (!decoder->decode(CoreIPC::Out(width, height)))
    68             return false;
    69        
    70         s.setWidth(width);
    71         s.setHeight(height);
    72         return true;
    73     }
    74 
    75 };
    76 
    77 template<> struct ArgumentCoder<WebCore::IntRect> {
    78     static void encode(ArgumentEncoder* encoder, const WebCore::IntRect& r)
    79     {
    80         encoder->encode(CoreIPC::In(r.location(), r.size()));
    81     };
    82    
    83     static bool decode(ArgumentDecoder* decoder, WebCore::IntRect& r)
    84     {
    85         WebCore::IntPoint location;
    86         WebCore::IntSize size;
    87         if (!decoder->decode(CoreIPC::Out(location, size)))
    88             return false;
    89        
    90         r.setLocation(location);
    91         r.setSize(size);
    92         return true;
    93     }
    94 };
     39template<> struct ArgumentCoder<WebCore::IntPoint> : SimpleArgumentCoder<WebCore::IntPoint> { };
     40template<> struct ArgumentCoder<WebCore::IntSize> : SimpleArgumentCoder<WebCore::IntSize> { };
     41template<> struct ArgumentCoder<WebCore::IntRect> : SimpleArgumentCoder<WebCore::IntRect> { };
    9542
    9643template<> struct ArgumentCoder<WebCore::String> {
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r61634 r61639  
    4242                1AEFCCBD11D02C5E008219D3 /* PluginInfoStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */; };
    4343                1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */; };
     44                1AEFD2F711D1807B008219D3 /* SimpleArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD2F611D1807B008219D3 /* SimpleArgumentCoder.h */; };
    4445                1AF3060A111B599E00F96436 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; };
    4546                5DAD729C116FF86200EE5396 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
     
    262263                1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInfoStoreMac.mm; sourceTree = "<group>"; };
    263264                1AEFD27811D16C81008219D3 /* ArgumentCoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCoder.h; sourceTree = "<group>"; };
     265                1AEFD2F611D1807B008219D3 /* SimpleArgumentCoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleArgumentCoder.h; sourceTree = "<group>"; };
    264266                32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
    265267                5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; };
     
    577579                                BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */,
    578580                                BC032DA410F437D10058C15A /* MessageID.h */,
     581                                1AEFD2F611D1807B008219D3 /* SimpleArgumentCoder.h */,
    579582                        );
    580583                        path = CoreIPC;
     
    10431046                                BCB7346E11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h in Headers */,
    10441047                                1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */,
     1048                                1AEFD2F711D1807B008219D3 /* SimpleArgumentCoder.h in Headers */,
    10451049                        );
    10461050                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.