Changeset 268854 in webkit
- Timestamp:
- Oct 21, 2020, 10:24:58 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 1 added
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Platform/IPC/JSIPCBinding.cpp (added)
-
Platform/IPC/JSIPCBinding.h (modified) (6 diffs)
-
Sources.txt (modified) (1 diff)
-
WebKit.xcodeproj/project.pbxproj (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r268848 r268854 1 2020-10-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 Move function definitions in JSIPCBinding.h into cpp file 4 https://bugs.webkit.org/show_bug.cgi?id=218065 5 6 Reviewed by Wenson Hsieh. 7 8 Added JSIPCBinding.cpp and moved the code from JSIPCBinding.h to JSIPCBinding.cpp. 9 10 No new tests since there is no behavior change. 11 12 * Platform/IPC/JSIPCBinding.cpp: Added. 13 (IPC::jsValueForDecodedStringArgumentValue): Moved from .h. 14 (IPC::jsValueForDecodedArgumentValue<String>): Ditto. 15 (IPC::jsValueForDecodedArgumentValue<URL>): Ditto. 16 (IPC::jsValueForDecodedArgumentValue<RegistrableDomain>): Ditto. 17 (IPC::jsValueForDecodedNumericArgumentValue): Ditto. 18 (IPC::jsValueForDecodedArgumentValue<double>): Ditto. 19 (IPC::jsValueForDecodedArgumentValue<float>): Ditto. 20 (IPC::jsValueForDecodedArgumentValue<int8_t>): Ditto. 21 (IPC::jsValueForDecodedArgumentValue<int16_t>): Ditto. 22 (IPC::jsValueForDecodedArgumentValue<int32_t>): Ditto. 23 (IPC::jsValueForDecodedArgumentValue<int64_t>): Ditto. 24 (IPC::jsValueForDecodedArgumentValue<uint8_t>): Ditto. 25 (IPC::jsValueForDecodedArgumentValue<uint16_t>): Ditto. 26 (IPC::jsValueForDecodedArgumentValue<uint32_t>): Ditto. 27 (IPC::jsValueForDecodedArgumentValue<uint64_t>): Ditto. 28 (IPC::jsValueForDecodedArgumentRect): Ditto. 29 (IPC::jsValueForDecodedArgumentValue<IntRect>): Ditto. 30 (IPC::jsValueForDecodedArgumentValue<FloatRect>): Ditto. 31 * Platform/IPC/JSIPCBinding.h: 32 (IPC::jsValueForDecodedArgumentValue): 33 * Sources.txt: 34 * WebKit.xcodeproj/project.pbxproj: 35 1 36 2020-10-21 Ryosuke Niwa <rniwa@webkit.org> 2 37 -
trunk/Source/WebKit/Platform/IPC/JSIPCBinding.h
r268848 r268854 26 26 #pragma once 27 27 28 #if ENABLE(IPC_TESTING_API) 29 28 30 #include "Decoder.h" 29 31 #include "HandleMessage.h" … … 32 34 #include <JavaScriptCore/JSObject.h> 33 35 #include <JavaScriptCore/ObjectConstructor.h> 34 #include <WebCore/FloatRect.h>35 #include <WebCore/IntRect.h>36 #include <WebCore/RegistrableDomain.h>37 36 #include <wtf/ObjectIdentifier.h> 38 #include <wtf/URL.h>39 37 #include <wtf/text/WTFString.h> 38 39 namespace WTF { 40 41 class URL; 42 43 } 44 45 namespace WebCore { 46 47 class FloatRect; 48 class IntRect; 49 class RegistrableDomain; 50 51 } 40 52 41 53 namespace IPC { … … 47 59 } 48 60 49 inline JSC::JSValue jsValueForDecodedStringArgumentValue(JSC::JSGlobalObject* globalObject, const String& value, ASCIILiteral type) 50 { 51 auto& vm = globalObject->vm(); 52 auto scope = DECLARE_THROW_SCOPE(vm); 53 auto* object = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype()); 54 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 55 object->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s), JSC::jsNontrivialString(vm, type)); 56 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 57 object->putDirect(vm, JSC::Identifier::fromString(vm, "value"_s), value.isNull() ? JSC::jsNull() : JSC::jsString(vm, value)); 58 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 59 return object; 60 } 61 62 template<> 63 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const String& value) 64 { 65 return jsValueForDecodedStringArgumentValue(globalObject, value, "String"_s); 66 } 67 68 template<> 69 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const URL& value) 70 { 71 return jsValueForDecodedStringArgumentValue(globalObject, value.string(), "URL"_s); 72 } 73 74 template<> 75 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const WebCore::RegistrableDomain& value) 76 { 77 return jsValueForDecodedStringArgumentValue(globalObject, value.string(), "RegistrableDomain"_s); 78 } 61 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const String&); 62 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const URL&); 63 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::RegistrableDomain&); 79 64 80 65 template<typename T, std::enable_if_t<std::is_arithmetic<T>::value>* = nullptr> … … 89 74 } 90 75 91 template<typename NumericType> 92 JSC::JSValue jsValueForDecodedNumericArgumentValue(JSC::JSGlobalObject* globalObject, NumericType value, const String& type) 93 { 94 auto& vm = globalObject->vm(); 95 auto scope = DECLARE_THROW_SCOPE(vm); 96 auto* object = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype()); 97 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 98 object->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s), JSC::jsNontrivialString(vm, type)); 99 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 100 object->putDirect(vm, JSC::Identifier::fromString(vm, "value"_s), JSC::JSValue(value)); 101 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 102 return object; 103 } 76 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, bool); 77 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, double); 78 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, float); 79 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int8_t); 80 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int16_t); 81 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int32_t); 104 82 105 template<> 106 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, bool value) 107 { 108 auto& vm = globalObject->vm(); 109 auto scope = DECLARE_THROW_SCOPE(vm); 110 auto* object = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype()); 111 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 112 object->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s), JSC::jsNontrivialString(vm, "bool")); 113 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 114 object->putDirect(vm, JSC::Identifier::fromString(vm, "value"_s), JSC::jsBoolean(value)); 115 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 116 return object; 117 } 118 119 template<> 120 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, double value) 121 { 122 return jsValueForDecodedNumericArgumentValue(globalObject, value, "double"); 123 } 124 125 template<> 126 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, float value) 127 { 128 return jsValueForDecodedNumericArgumentValue(globalObject, value, "float"); 129 } 130 131 template<> 132 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, int8_t value) 133 { 134 return jsValueForDecodedNumericArgumentValue(globalObject, value, "int8_t"); 135 } 136 137 template<> 138 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, int16_t value) 139 { 140 return jsValueForDecodedNumericArgumentValue(globalObject, value, "int16_t"); 141 } 142 143 template<> 144 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, int32_t value) 145 { 146 return jsValueForDecodedNumericArgumentValue(globalObject, value, "int32_t"); 147 } 148 149 template<> 150 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, int64_t value) 151 { 152 return jsValueForDecodedNumericArgumentValue(globalObject, value, "int64_t"); 153 } 154 155 template<> 156 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, uint8_t value) 157 { 158 return jsValueForDecodedNumericArgumentValue(globalObject, value, "uint8_t"); 159 } 160 161 template<> 162 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, uint16_t value) 163 { 164 return jsValueForDecodedNumericArgumentValue(globalObject, value, "uint16_t"); 165 } 166 167 template<> 168 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, uint32_t value) 169 { 170 return jsValueForDecodedNumericArgumentValue(globalObject, value, "uint32_t"); 171 } 172 173 template<> 174 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, uint64_t value) 175 { 176 return jsValueForDecodedNumericArgumentValue(globalObject, value, "uint64_t"); 177 } 83 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int64_t); 84 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint8_t); 85 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint16_t); 86 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint32_t); 87 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint64_t); 178 88 179 89 template<typename U> … … 183 93 } 184 94 185 template<typename RectType> 186 JSC::JSValue jsValueForDecodedArgumentRect(JSC::JSGlobalObject* globalObject, const RectType& value, const String& type) 187 { 188 auto& vm = globalObject->vm(); 189 auto scope = DECLARE_THROW_SCOPE(vm); 190 auto* object = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype()); 191 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 192 object->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s), JSC::jsNontrivialString(vm, type)); 193 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 194 object->putDirect(vm, JSC::Identifier::fromString(vm, "x"_s), JSC::JSValue(value.x())); 195 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 196 object->putDirect(vm, JSC::Identifier::fromString(vm, "y"_s), JSC::JSValue(value.y())); 197 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 198 object->putDirect(vm, JSC::Identifier::fromString(vm, "width"_s), JSC::JSValue(value.width())); 199 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 200 object->putDirect(vm, JSC::Identifier::fromString(vm, "height"_s), JSC::JSValue(value.height())); 201 RETURN_IF_EXCEPTION(scope, JSC::JSValue()); 202 return object; 203 } 204 205 template<> 206 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const WebCore::IntRect& value) 207 { 208 return jsValueForDecodedArgumentRect(globalObject, value, "IntRect"); 209 } 210 211 template<> 212 JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const WebCore::FloatRect& value) 213 { 214 return jsValueForDecodedArgumentRect(globalObject, value, "FloatRect"); 215 } 95 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::IntRect&); 96 template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::FloatRect&); 216 97 217 98 template<typename U> … … 275 156 276 157 } 158 159 #endif -
trunk/Source/WebKit/Sources.txt
r268637 r268854 138 138 Platform/IPC/Decoder.cpp @no-unify 139 139 Platform/IPC/Encoder.cpp @no-unify 140 Platform/IPC/JSIPCBinding.cpp @no-unify 140 141 Platform/IPC/MessageReceiverMap.cpp @no-unify 141 142 Platform/IPC/MessageSender.cpp @no-unify -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r268736 r268854 1448 1448 9B5BEC262400F4A90070C6EF /* WebMediaStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5BEC242400F4A90070C6EF /* WebMediaStrategy.h */; }; 1449 1449 9B5BEC2A240101580070C6EF /* RemoteAudioDestinationProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5BEC28240101580070C6EF /* RemoteAudioDestinationProxy.h */; }; 1450 9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */; }; 1450 1451 9EC532A32447FBAD00215216 /* GeolocationIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EC532A22447FBAD00215216 /* GeolocationIdentifier.h */; }; 1451 1452 9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 4584 4585 9BC59D6C1EFCCCB6001E8D09 /* CallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackID.h; sourceTree = "<group>"; }; 4585 4586 9BC59D6D1EFCDC6D001E8D09 /* OptionalCallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionalCallbackID.h; sourceTree = "<group>"; }; 4587 9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSIPCBinding.cpp; sourceTree = "<group>"; }; 4586 4588 9EC532A22447FBAD00215216 /* GeolocationIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeolocationIdentifier.h; sourceTree = "<group>"; }; 4587 4589 9F54F88E16488E87007DF81A /* AuxiliaryProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AuxiliaryProcessMac.mm; sourceTree = "<group>"; }; … … 6507 6509 C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */, 6508 6510 1C9AF36124134D2300D3EC02 /* ImageDataReference.h */, 6511 9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */, 6509 6512 9B47908E253151CC00EC11AB /* JSIPCBinding.h */, 6510 6513 9B47908C25314D8300EC11AB /* MessageArgumentDescriptions.h */, … … 12987 12990 2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */, 12988 12991 2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */, 12992 9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */, 12989 12993 2D913441212CF9F000128AFD /* JSNPMethod.cpp in Sources */, 12990 12994 2D913442212CF9F000128AFD /* JSNPObject.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.