Changeset 61639 in webkit
- Timestamp:
- Jun 22, 2010 4:55:28 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r61635 r61639 1 2010-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 1 15 2010-06-22 Anders Carlsson <andersca@apple.com> 2 16 -
trunk/WebKit2/Shared/WebCoreTypeArgumentMarshalling.h
r61635 r61639 30 30 #include "ArgumentEncoder.h" 31 31 #include "Arguments.h" 32 #include "SimpleArgumentCoder.h" 32 33 #include <WebCore/FloatRect.h> 33 34 #include <WebCore/IntRect.h> … … 36 37 namespace CoreIPC { 37 38 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 }; 39 template<> struct ArgumentCoder<WebCore::IntPoint> : SimpleArgumentCoder<WebCore::IntPoint> { }; 40 template<> struct ArgumentCoder<WebCore::IntSize> : SimpleArgumentCoder<WebCore::IntSize> { }; 41 template<> struct ArgumentCoder<WebCore::IntRect> : SimpleArgumentCoder<WebCore::IntRect> { }; 95 42 96 43 template<> struct ArgumentCoder<WebCore::String> { -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r61634 r61639 42 42 1AEFCCBD11D02C5E008219D3 /* PluginInfoStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */; }; 43 43 1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */; }; 44 1AEFD2F711D1807B008219D3 /* SimpleArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD2F611D1807B008219D3 /* SimpleArgumentCoder.h */; }; 44 45 1AF3060A111B599E00F96436 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; }; 45 46 5DAD729C116FF86200EE5396 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; … … 262 263 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInfoStoreMac.mm; sourceTree = "<group>"; }; 263 264 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>"; }; 264 266 32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; }; 265 267 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; }; … … 577 579 BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */, 578 580 BC032DA410F437D10058C15A /* MessageID.h */, 581 1AEFD2F611D1807B008219D3 /* SimpleArgumentCoder.h */, 579 582 ); 580 583 path = CoreIPC; … … 1043 1046 BCB7346E11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h in Headers */, 1044 1047 1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */, 1048 1AEFD2F711D1807B008219D3 /* SimpleArgumentCoder.h in Headers */, 1045 1049 ); 1046 1050 runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset
for help on using the changeset viewer.