⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 268854 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 10:24:58 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

Move function definitions in JSIPCBinding.h into cpp file
https://bugs.webkit.org/show_bug.cgi?id=218065

Reviewed by Wenson Hsieh.

Added JSIPCBinding.cpp and moved the code from JSIPCBinding.h to JSIPCBinding.cpp.

No new tests since there is no behavior change.

  • Platform/IPC/JSIPCBinding.cpp: Added.

(IPC::jsValueForDecodedStringArgumentValue): Moved from .h.
(IPC::jsValueForDecodedArgumentValue<String>): Ditto.
(IPC::jsValueForDecodedArgumentValue<URL>): Ditto.
(IPC::jsValueForDecodedArgumentValue<RegistrableDomain>): Ditto.
(IPC::jsValueForDecodedNumericArgumentValue): Ditto.
(IPC::jsValueForDecodedArgumentValue<double>): Ditto.
(IPC::jsValueForDecodedArgumentValue<float>): Ditto.
(IPC::jsValueForDecodedArgumentValue<int8_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<int16_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<int32_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<int64_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<uint8_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<uint16_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<uint32_t>): Ditto.
(IPC::jsValueForDecodedArgumentValue<uint64_t>): Ditto.
(IPC::jsValueForDecodedArgumentRect): Ditto.
(IPC::jsValueForDecodedArgumentValue<IntRect>): Ditto.
(IPC::jsValueForDecodedArgumentValue<FloatRect>): Ditto.

  • Platform/IPC/JSIPCBinding.h:

(IPC::jsValueForDecodedArgumentValue):

  • Sources.txt:
  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebKit
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r268848 r268854  
     12020-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
    1362020-10-21  Ryosuke Niwa  <rniwa@webkit.org>
    237
  • trunk/Source/WebKit/Platform/IPC/JSIPCBinding.h

    r268848 r268854  
    2626#pragma once
    2727
     28#if ENABLE(IPC_TESTING_API)
     29
    2830#include "Decoder.h"
    2931#include "HandleMessage.h"
     
    3234#include <JavaScriptCore/JSObject.h>
    3335#include <JavaScriptCore/ObjectConstructor.h>
    34 #include <WebCore/FloatRect.h>
    35 #include <WebCore/IntRect.h>
    36 #include <WebCore/RegistrableDomain.h>
    3736#include <wtf/ObjectIdentifier.h>
    38 #include <wtf/URL.h>
    3937#include <wtf/text/WTFString.h>
     38
     39namespace WTF {
     40
     41class URL;
     42
     43}
     44
     45namespace WebCore {
     46
     47class FloatRect;
     48class IntRect;
     49class RegistrableDomain;
     50
     51}
    4052
    4153namespace IPC {
     
    4759}
    4860
    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 }
     61template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const String&);
     62template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const URL&);
     63template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::RegistrableDomain&);
    7964
    8065template<typename T, std::enable_if_t<std::is_arithmetic<T>::value>* = nullptr>
     
    8974}
    9075
    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 }
     76template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, bool);
     77template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, double);
     78template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, float);
     79template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int8_t);
     80template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int16_t);
     81template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int32_t);
    10482
    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 }
     83template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, int64_t);
     84template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint8_t);
     85template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint16_t);
     86template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint32_t);
     87template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint64_t);
    17888
    17989template<typename U>
     
    18393}
    18494
    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 }
     95template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::IntRect&);
     96template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, const WebCore::FloatRect&);
    21697
    21798template<typename U>
     
    275156
    276157}
     158
     159#endif
  • trunk/Source/WebKit/Sources.txt

    r268637 r268854  
    138138Platform/IPC/Decoder.cpp @no-unify
    139139Platform/IPC/Encoder.cpp @no-unify
     140Platform/IPC/JSIPCBinding.cpp @no-unify
    140141Platform/IPC/MessageReceiverMap.cpp @no-unify
    141142Platform/IPC/MessageSender.cpp @no-unify
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r268736 r268854  
    14481448                9B5BEC262400F4A90070C6EF /* WebMediaStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5BEC242400F4A90070C6EF /* WebMediaStrategy.h */; };
    14491449                9B5BEC2A240101580070C6EF /* RemoteAudioDestinationProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5BEC28240101580070C6EF /* RemoteAudioDestinationProxy.h */; };
     1450                9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */; };
    14501451                9EC532A32447FBAD00215216 /* GeolocationIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EC532A22447FBAD00215216 /* GeolocationIdentifier.h */; };
    14511452                9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    45844585                9BC59D6C1EFCCCB6001E8D09 /* CallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackID.h; sourceTree = "<group>"; };
    45854586                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>"; };
    45864588                9EC532A22447FBAD00215216 /* GeolocationIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeolocationIdentifier.h; sourceTree = "<group>"; };
    45874589                9F54F88E16488E87007DF81A /* AuxiliaryProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AuxiliaryProcessMac.mm; sourceTree = "<group>"; };
     
    65076509                                C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */,
    65086510                                1C9AF36124134D2300D3EC02 /* ImageDataReference.h */,
     6511                                9BF5EC6325410E9900984E77 /* JSIPCBinding.cpp */,
    65096512                                9B47908E253151CC00EC11AB /* JSIPCBinding.h */,
    65106513                                9B47908C25314D8300EC11AB /* MessageArgumentDescriptions.h */,
     
    1298712990                                2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */,
    1298812991                                2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */,
     12992                                9BF5EC642541145600984E77 /* JSIPCBinding.cpp in Sources */,
    1298912993                                2D913441212CF9F000128AFD /* JSNPMethod.cpp in Sources */,
    1299012994                                2D913442212CF9F000128AFD /* JSNPObject.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.