Changeset 243460 in webkit


Ignore:
Timestamp:
Mar 25, 2019 2:23:15 PM (5 years ago)
Author:
achristensen@apple.com
Message:

Enable IPC sending and receiving non-default-constructible types
https://bugs.webkit.org/show_bug.cgi?id=196132

Reviewed by Geoff Garen.

Source/WebCore:

This basically just requires the decoding of std::tuple to return an Optional<std::tuple> instead of
constructing a std::tuple then decoding into it. I now decode synchronous replies into an Optional<std::tuple>
then move it into the tuple of references where the successfully decoded reply should go. This required
the synchronous reply types be move constructible and move assignable.

  • Modules/indexeddb/shared/IDBRequestData.h:
  • Modules/indexeddb/shared/IDBTransactionInfo.h:
  • platform/DragImage.h:
  • platform/PasteboardWriterData.h:
  • platform/audio/mac/CAAudioStreamDescription.h:
  • platform/graphics/RemoteVideoSample.h:

Source/WebKit:

  • Platform/IPC/ArgumentCoder.h:
  • Platform/IPC/ArgumentCoders.h:

(IPC::TupleEncoder::encode):
(IPC::tupleFromTupleAndObject):
(IPC::TupleDecoderImpl::decode):
(IPC::TupleDecoderImpl<Type>::decode):
(IPC::TupleDecoder::decode):
(IPC::TupleDecoder<0>::decode):
(IPC::TupleCoder::encode): Deleted.
(IPC::TupleCoder::decode): Deleted.

  • Platform/IPC/Connection.h:

(IPC::Connection::sendWithReply):
(IPC::TupleMover::move):
(IPC::moveTuple):
(IPC::Connection::sendSync):

  • Platform/IPC/Decoder.h:

(IPC::Decoder::decode):
(IPC::Decoder::operator>>):

  • Platform/IPC/HandleMessage.h:

(IPC::handleMessage):
(IPC::handleMessageSynchronous):
(IPC::handleMessageSynchronousWantsConnection):
(IPC::handleMessageAsync):

  • Platform/SharedMemory.h:
  • Scripts/webkit/LegacyMessages-expected.h:
  • Scripts/webkit/Messages-expected.h:
  • Scripts/webkit/MessagesSuperclass-expected.h:
  • Scripts/webkit/messages.py:
  • Shared/Databases/IndexedDB/WebIDBResult.h:
  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
  • Shared/ShareableBitmap.h:
  • Shared/ShareableResource.h:
  • Shared/UpdateInfo.h:
  • Shared/WebEvent.h:
  • Shared/WebProcessCreationParameters.cpp:
  • Shared/WebProcessCreationParameters.h:
  • Shared/mac/SecItemResponseData.cpp:

(WebKit::SecItemResponseData::SecItemResponseData):
(WebKit::SecItemResponseData::decode):

  • Shared/mac/SecItemResponseData.h:
  • WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
Location:
trunk/Source
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r243459 r243460  
     12019-03-25  Alex Christensen  <achristensen@webkit.org>
     2
     3        Enable IPC sending and receiving non-default-constructible types
     4        https://bugs.webkit.org/show_bug.cgi?id=196132
     5
     6        Reviewed by Geoff Garen.
     7
     8        This basically just requires the decoding of std::tuple to return an Optional<std::tuple> instead of
     9        constructing a std::tuple then decoding into it.  I now decode synchronous replies into an Optional<std::tuple>
     10        then move it into the tuple of references where the successfully decoded reply should go.  This required
     11        the synchronous reply types be move constructible and move assignable.
     12
     13        * Modules/indexeddb/shared/IDBRequestData.h:
     14        * Modules/indexeddb/shared/IDBTransactionInfo.h:
     15        * platform/DragImage.h:
     16        * platform/PasteboardWriterData.h:
     17        * platform/audio/mac/CAAudioStreamDescription.h:
     18        * platform/graphics/RemoteVideoSample.h:
     19
    1202019-03-25  Alex Christensen  <achristensen@webkit.org>
    221
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h

    r239427 r243460  
    5151    explicit IDBRequestData(IDBClient::TransactionOperation&);
    5252    IDBRequestData(const IDBRequestData&);
     53    IDBRequestData(IDBRequestData&&) = default;
     54    IDBRequestData& operator=(IDBRequestData&&) = default;
    5355
    5456    enum IsolatedCopyTag { IsolatedCopy };
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h

    r241183 r243460  
    5151
    5252    IDBTransactionInfo(const IDBTransactionInfo&);
     53    IDBTransactionInfo(IDBTransactionInfo&&) = default;
     54    IDBTransactionInfo& operator=(IDBTransactionInfo&&) = default;
    5355
    5456    enum IsolatedCopyTag { IsolatedCopy };
  • trunk/Source/WebCore/platform/DragImage.h

    r239427 r243460  
    103103    WEBCORE_EXPORT DragImage();
    104104    explicit DragImage(DragImageRef);
    105     DragImage(DragImage&&);
     105    WEBCORE_EXPORT DragImage(DragImage&&);
    106106    WEBCORE_EXPORT ~DragImage();
    107107
    108     DragImage& operator=(DragImage&&);
     108    WEBCORE_EXPORT DragImage& operator=(DragImage&&);
    109109
    110110    void setIndicatorData(const TextIndicatorData& data) { m_indicatorData = data; }
  • trunk/Source/WebCore/platform/PasteboardWriterData.h

    r239427 r243460  
    4848    struct WebContent {
    4949        WebContent();
    50         ~WebContent();
     50        WEBCORE_EXPORT ~WebContent();
    5151
    5252#if PLATFORM(COCOA)
  • trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h

    r241183 r243460  
    3434inline bool operator!=(const AudioStreamBasicDescription& a, const AudioStreamBasicDescription& b) { return !(a == b); }
    3535
    36 class CAAudioStreamDescription final : public AudioStreamDescription {
     36class WEBCORE_EXPORT CAAudioStreamDescription final : public AudioStreamDescription {
    3737    WTF_MAKE_FAST_ALLOCATED;
    3838
    3939public:
    4040
    41     WEBCORE_EXPORT CAAudioStreamDescription();
    42     WEBCORE_EXPORT CAAudioStreamDescription(const AudioStreamBasicDescription&);
    43     WEBCORE_EXPORT CAAudioStreamDescription(double, uint32_t, PCMFormat, bool);
    44     WEBCORE_EXPORT ~CAAudioStreamDescription();
     41    CAAudioStreamDescription();
     42    CAAudioStreamDescription(const AudioStreamBasicDescription&);
     43    CAAudioStreamDescription(double, uint32_t, PCMFormat, bool);
     44    ~CAAudioStreamDescription();
    4545
    4646    const PlatformDescription& platformDescription() const final;
    4747
    48     WEBCORE_EXPORT PCMFormat format() const final;
     48    PCMFormat format() const final;
    4949
    5050    double sampleRate() const final { return m_streamDescription.mSampleRate; }
  • trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h

    r237281 r243460  
    4242public:
    4343    RemoteVideoSample() = default;
     44    RemoteVideoSample(RemoteVideoSample&&) = default;
     45    RemoteVideoSample& operator=(RemoteVideoSample&&) = default;
    4446    ~RemoteVideoSample() = default;
    4547
  • trunk/Source/WebKit/ChangeLog

    r243454 r243460  
     12019-03-25  Alex Christensen  <achristensen@webkit.org>
     2
     3        Enable IPC sending and receiving non-default-constructible types
     4        https://bugs.webkit.org/show_bug.cgi?id=196132
     5
     6        Reviewed by Geoff Garen.
     7
     8        * Platform/IPC/ArgumentCoder.h:
     9        * Platform/IPC/ArgumentCoders.h:
     10        (IPC::TupleEncoder::encode):
     11        (IPC::tupleFromTupleAndObject):
     12        (IPC::TupleDecoderImpl::decode):
     13        (IPC::TupleDecoderImpl<Type>::decode):
     14        (IPC::TupleDecoder::decode):
     15        (IPC::TupleDecoder<0>::decode):
     16        (IPC::TupleCoder::encode): Deleted.
     17        (IPC::TupleCoder::decode): Deleted.
     18        * Platform/IPC/Connection.h:
     19        (IPC::Connection::sendWithReply):
     20        (IPC::TupleMover::move):
     21        (IPC::moveTuple):
     22        (IPC::Connection::sendSync):
     23        * Platform/IPC/Decoder.h:
     24        (IPC::Decoder::decode):
     25        (IPC::Decoder::operator>>):
     26        * Platform/IPC/HandleMessage.h:
     27        (IPC::handleMessage):
     28        (IPC::handleMessageSynchronous):
     29        (IPC::handleMessageSynchronousWantsConnection):
     30        (IPC::handleMessageAsync):
     31        * Platform/SharedMemory.h:
     32        * Scripts/webkit/LegacyMessages-expected.h:
     33        * Scripts/webkit/Messages-expected.h:
     34        * Scripts/webkit/MessagesSuperclass-expected.h:
     35        * Scripts/webkit/messages.py:
     36        * Shared/Databases/IndexedDB/WebIDBResult.h:
     37        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
     38        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
     39        * Shared/ShareableBitmap.h:
     40        * Shared/ShareableResource.h:
     41        * Shared/UpdateInfo.h:
     42        * Shared/WebEvent.h:
     43        * Shared/WebProcessCreationParameters.cpp:
     44        * Shared/WebProcessCreationParameters.h:
     45        * Shared/mac/SecItemResponseData.cpp:
     46        (WebKit::SecItemResponseData::SecItemResponseData):
     47        (WebKit::SecItemResponseData::decode):
     48        * Shared/mac/SecItemResponseData.h:
     49        * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
     50
    1512019-03-25  Tim Horton  <timothy_horton@apple.com>
    252
  • trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h

    r239427 r243460  
    4242template<typename> struct ArgumentCoder;
    4343
     44template<typename> class UsesModernDecoder;
     45
    4446template<typename U>
    4547class UsesModernDecoder {
     
    5355    static constexpr bool argumentCoderValue = sizeof(check<U>(nullptr)) == sizeof(uint8_t);
    5456    static constexpr bool value = argumentCoderValue || sizeof(checkArgumentCoder<U>(nullptr)) == sizeof(uint8_t);
     57};
     58   
     59template<typename... Types>
     60class UsesModernDecoder<std::tuple<Types...>> {
     61public:
     62    static constexpr bool value = true;
     63    static constexpr bool argumentCoderValue = true;
    5564};
    5665
  • trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h

    r243163 r243460  
    161161
    162162template<size_t index, typename... Elements>
    163 struct TupleCoder {
     163struct TupleEncoder {
    164164    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
    165165    {
    166166        encoder << std::get<sizeof...(Elements) - index>(tuple);
    167         TupleCoder<index - 1, Elements...>::encode(encoder, tuple);
    168     }
    169 
    170     template<typename U = typename std::remove_reference<typename std::tuple_element<sizeof...(Elements) - index, std::tuple<Elements...>>::type>::type, std::enable_if_t<!UsesModernDecoder<U>::value>* = nullptr>
    171     static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
    172     {
    173         if (!decoder.decode(std::get<sizeof...(Elements) - index>(tuple)))
    174             return false;
    175         return TupleCoder<index - 1, Elements...>::decode(decoder, tuple);
    176     }
    177    
    178     template<typename U = typename std::remove_reference<typename std::tuple_element<sizeof...(Elements) - index, std::tuple<Elements...>>::type>::type, std::enable_if_t<UsesModernDecoder<U>::value>* = nullptr>
    179     static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
    180     {
    181         Optional<U> optional;
     167        TupleEncoder<index - 1, Elements...>::encode(encoder, tuple);
     168    }
     169};
     170
     171template<typename... Elements>
     172struct TupleEncoder<0, Elements...> {
     173    static void encode(Encoder&, const std::tuple<Elements...>&)
     174    {
     175    }
     176};
     177
     178template <typename T, typename... Elements, size_t... Indices>
     179auto tupleFromTupleAndObject(T&& object, std::tuple<Elements...>&& tuple, std::index_sequence<Indices...>)
     180{
     181    return std::make_tuple(WTFMove(object), WTFMove(std::get<Indices>(tuple))...);
     182}
     183
     184template <typename T, typename... Elements>
     185auto tupleFromTupleAndObject(T&& object, std::tuple<Elements...>&& tuple)
     186{
     187    return tupleFromTupleAndObject(WTFMove(object), WTFMove(tuple), std::index_sequence_for<Elements...>());
     188}
     189
     190template<typename Type, typename... Types>
     191struct TupleDecoderImpl {
     192    static Optional<std::tuple<Type, Types...>> decode(Decoder& decoder)
     193    {
     194        Optional<Type> optional;
    182195        decoder >> optional;
    183196        if (!optional)
    184             return false;
    185         std::get<sizeof...(Elements) - index>(tuple) = WTFMove(*optional);
    186         return TupleCoder<index - 1, Elements...>::decode(decoder, tuple);
    187     }
    188 };
    189 
    190 template<typename... Elements>
    191 struct TupleCoder<0, Elements...> {
    192     static void encode(Encoder&, const std::tuple<Elements...>&)
    193     {
    194     }
    195 
    196     static bool decode(Decoder&, std::tuple<Elements...>&)
    197     {
    198         return true;
     197            return WTF::nullopt;
     198
     199        Optional<std::tuple<Types...>> subTuple = TupleDecoderImpl<Types...>::decode(decoder);
     200        if (!subTuple)
     201            return WTF::nullopt;
     202
     203        return tupleFromTupleAndObject(WTFMove(*optional), WTFMove(*subTuple));
     204    }
     205};
     206
     207template<typename Type>
     208struct TupleDecoderImpl<Type> {
     209    static Optional<std::tuple<Type>> decode(Decoder& decoder)
     210    {
     211        Optional<Type> optional;
     212        decoder >> optional;
     213        if (!optional)
     214            return WTF::nullopt;
     215        return std::make_tuple(WTFMove(*optional));
     216    }
     217};
     218
     219template<size_t size, typename... Elements>
     220struct TupleDecoder {
     221    static Optional<std::tuple<Elements...>> decode(Decoder& decoder)
     222    {
     223        return TupleDecoderImpl<Elements...>::decode(decoder);
     224    }
     225};
     226
     227template<>
     228struct TupleDecoder<0> {
     229    static Optional<std::tuple<>> decode(Decoder& decoder)
     230    {
     231        return std::make_tuple();
    199232    }
    200233};
     
    203236    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
    204237    {
    205         TupleCoder<sizeof...(Elements), Elements...>::encode(encoder, tuple);
    206     }
    207 
    208     static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
    209     {
    210         return TupleCoder<sizeof...(Elements), Elements...>::decode(decoder, tuple);
    211     }
    212 };
    213 
     238        TupleEncoder<sizeof...(Elements), Elements...>::encode(encoder, tuple);
     239    }
     240
     241    static Optional<std::tuple<Elements...>> decode(Decoder& decoder)
     242    {
     243        return TupleDecoder<sizeof...(Elements), Elements...>::decode(decoder);
     244    }
     245};
    214246
    215247template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType>> {
  • trunk/Source/WebKit/Platform/IPC/Connection.h

    r241183 r243460  
    445445    sendMessageWithReply(requestID, WTFMove(encoder), replyDispatcher, [replyHandler = WTFMove(replyHandler)](std::unique_ptr<Decoder> decoder) {
    446446        if (decoder) {
    447             typename CodingType<typename T::Reply>::Type reply;
    448             if (decoder->decode(reply)) {
    449                 replyHandler(WTFMove(reply));
     447            Optional<typename CodingType<typename T::Reply>::Type> reply;
     448            *decoder >> reply;
     449            if (reply) {
     450                replyHandler(WTFMove(*reply));
    450451                return;
    451452            }
     
    454455        replyHandler(WTF::nullopt);
    455456    });
     457}
     458
     459template<size_t i, typename A, typename B> struct TupleMover {
     460    static void move(A&& a, B& b)
     461    {
     462        std::get<i - 1>(b) = WTFMove(std::get<i - 1>(a));
     463        TupleMover<i - 1, A, B>::move(WTFMove(a), b);
     464    }
     465};
     466
     467template<typename A, typename B> struct TupleMover<0, A, B> {
     468    static void move(A&&, B&) { }
     469};
     470
     471template<typename... A, typename... B>
     472void moveTuple(std::tuple<A...>&& a, std::tuple<B...>& b)
     473{
     474    static_assert(sizeof...(A) == sizeof...(B), "Should be used with two tuples of same size");
     475    TupleMover<sizeof...(A), std::tuple<A...>, std::tuple<B...>>::move(WTFMove(a), b);
    456476}
    457477
     
    477497
    478498    // Decode the reply.
    479     return replyDecoder->decode(reply);
     499    Optional<typename T::ReplyArguments> replyArguments;
     500    *replyDecoder >> replyArguments;
     501    if (!replyArguments)
     502        return false;
     503    moveTuple(WTFMove(*replyArguments), reply);
     504    return true;
    480505}
    481506
  • trunk/Source/WebKit/Platform/IPC/Decoder.h

    r239427 r243460  
    151151    }
    152152
     153    template<typename T, std::enable_if_t<!std::is_enum<T>::value && !UsesLegacyDecoder<T>::value>* = nullptr>
     154    bool decode(T& t)
     155    {
     156        Optional<T> optional;
     157        *this >> optional;
     158        if (!optional)
     159            return false;
     160        t = WTFMove(*optional);
     161        return true;
     162    }
     163
    153164    template<typename T, std::enable_if_t<UsesModernDecoder<T>::value>* = nullptr>
    154165    Decoder& operator>>(Optional<T>& t)
    155166    {
    156167        t = ArgumentCoder<T>::decode(*this);
     168        return *this;
     169    }
     170   
     171    template<typename T, std::enable_if_t<!std::is_enum<T>::value && !UsesModernDecoder<T>::value>* = nullptr>
     172    Decoder& operator>>(Optional<T>& optional)
     173    {
     174        T t;
     175        if (ArgumentCoder<T>::decode(*this, t)) {
     176            optional = WTFMove(t);
     177            return *this;
     178        }
     179        optional = WTF::nullopt;
    157180        return *this;
    158181    }
  • trunk/Source/WebKit/Platform/IPC/HandleMessage.h

    r243345 r243460  
    111111void handleMessage(Decoder& decoder, C* object, MF function)
    112112{
    113     typename CodingType<typename T::Arguments>::Type arguments;
    114     if (!decoder.decode(arguments)) {
     113    Optional<typename CodingType<typename T::Arguments>::Type> arguments;
     114    decoder >> arguments;
     115    if (!arguments) {
    115116        ASSERT(decoder.isInvalid());
    116117        return;
    117118    }
    118119
    119     callMemberFunction(WTFMove(arguments), object, function);
     120    callMemberFunction(WTFMove(*arguments), object, function);
    120121}
    121122
     
    123124void handleMessage(Connection& connection, Decoder& decoder, C* object, MF function)
    124125{
    125     typename CodingType<typename T::Arguments>::Type arguments;
    126     if (!decoder.decode(arguments)) {
     126    Optional<typename CodingType<typename T::Arguments>::Type> arguments;
     127    decoder >> arguments;
     128    if (!arguments) {
    127129        ASSERT(decoder.isInvalid());
    128130        return;
    129131    }
    130     callMemberFunction(connection, WTFMove(arguments), object, function);
     132    callMemberFunction(connection, WTFMove(*arguments), object, function);
    131133}
    132134
     
    134136void handleMessageSynchronous(Connection& connection, Decoder& decoder, std::unique_ptr<Encoder>& replyEncoder, C* object, MF function)
    135137{
    136     typename CodingType<typename T::Arguments>::Type arguments;
    137     if (!decoder.decode(arguments)) {
     138    Optional<typename CodingType<typename T::Arguments>::Type> arguments;
     139    decoder >> arguments;
     140    if (!arguments) {
    138141        ASSERT(decoder.isInvalid());
    139142        return;
     
    143146        T::send(WTFMove(replyEncoder), WTFMove(connection), args...);
    144147    };
    145     callMemberFunction(WTFMove(arguments), WTFMove(completionHandler), object, function);
     148    callMemberFunction(WTFMove(*arguments), WTFMove(completionHandler), object, function);
    146149}
    147150
     
    149152void handleMessageSynchronousWantsConnection(Connection& connection, Decoder& decoder, std::unique_ptr<Encoder>& replyEncoder, C* object, MF function)
    150153{
    151     typename CodingType<typename T::Arguments>::Type arguments;
    152     if (!decoder.decode(arguments)) {
     154    Optional<typename CodingType<typename T::Arguments>::Type> arguments;
     155    decoder >> arguments;
     156    if (!arguments) {
    153157        ASSERT(decoder.isInvalid());
    154158        return;
     
    158162        T::send(WTFMove(replyEncoder), WTFMove(connection), args...);
    159163    };
    160     callMemberFunction(connection, WTFMove(arguments), WTFMove(completionHandler), object, function);
     164    callMemberFunction(connection, WTFMove(*arguments), WTFMove(completionHandler), object, function);
    161165}
    162166
     
    171175    }
    172176   
    173     typename CodingType<typename T::Arguments>::Type arguments;
    174     if (!decoder.decode(arguments)) {
     177    Optional<typename CodingType<typename T::Arguments>::Type> arguments;
     178    decoder >> arguments;
     179    if (!arguments) {
    175180        ASSERT(decoder.isInvalid());
    176181        return;
     
    182187        T::send(WTFMove(encoder), WTFMove(connection), args...);
    183188    };
    184     callMemberFunction(WTFMove(arguments), WTFMove(completionHandler), object, function);
     189    callMemberFunction(WTFMove(*arguments), WTFMove(completionHandler), object, function);
    185190}
    186191
  • trunk/Source/WebKit/Platform/SharedMemory.h

    r239427 r243460  
    6565        Handle();
    6666        ~Handle();
     67        Handle(Handle&&);
     68        Handle& operator=(Handle&&);
    6769
    6870        bool isNull() const;
  • trunk/Source/WebKit/Platform/cocoa/SharedMemoryCocoa.cpp

    r239260 r243460  
    4747}
    4848
     49SharedMemory::Handle::Handle(Handle&& other)
     50{
     51    m_port = std::exchange(other.m_port, MACH_PORT_NULL);
     52    m_size = std::exchange(other.m_size, 0);
     53}
     54
     55auto SharedMemory::Handle::operator=(Handle&& other) -> Handle&
     56{
     57    m_port = std::exchange(other.m_port, MACH_PORT_NULL);
     58    m_size = std::exchange(other.m_size, 0);
     59    return *this;
     60}
     61
    4962SharedMemory::Handle::~Handle()
    5063{
  • trunk/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp

    r239427 r243460  
    6060}
    6161
     62SharedMemory::Handle::Handle(Handle&&) = default;
     63SharedMemory::Handle& SharedMemory::Handle::operator=(Handle&& other) = default;
     64
    6265void SharedMemory::Handle::clear()
    6366{
  • trunk/Source/WebKit/Platform/win/SharedMemoryWin.cpp

    r239261 r243460  
    4040}
    4141
     42SharedMemory::Handle::Handle(Handle&& other)
     43{
     44    m_handle = std::exchange(other.m_handle, 0);
     45    m_size = std::exchange(other.m_size, 0);
     46}
     47
     48auto SharedMemory::Handle::operator=(Handle&& other) -> Handle&
     49{
     50    m_handle = std::exchange(other.m_handle, 0);
     51    m_size = std::exchange(other.m_size, 0);
     52    return *this;
     53}
     54
    4255SharedMemory::Handle::~Handle()
    4356{
  • trunk/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h

    r241622 r243460  
    289289    static const bool isSync = true;
    290290
    291     typedef std::tuple<bool&> Reply;
     291    using Reply = std::tuple<bool&>;
     292    using ReplyArguments = std::tuple<bool>;
    292293    CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters)
    293294        : m_arguments(pluginInstanceID, parameters)
     
    312313    static const bool isSync = true;
    313314
    314     typedef std::tuple<> Reply;
     315    using Reply = std::tuple<>;
     316    using ReplyArguments = std::tuple<>;
    315317    RunJavaScriptAlert(uint64_t frameID, const String& message)
    316318        : m_arguments(frameID, message)
     
    335337    static const bool isSync = true;
    336338
    337     typedef std::tuple<Vector<WebCore::PluginInfo>&> Reply;
     339    using Reply = std::tuple<Vector<WebCore::PluginInfo>&>;
     340    using ReplyArguments = std::tuple<Vector<WebCore::PluginInfo>>;
    338341    explicit GetPlugins(bool refresh)
    339342        : m_arguments(refresh)
     
    360363    using DelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
    361364    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const IPC::Connection::Handle& connectionHandle);
    362     typedef std::tuple<IPC::Connection::Handle&> Reply;
     365    using Reply = std::tuple<IPC::Connection::Handle&>;
     366    using ReplyArguments = std::tuple<IPC::Connection::Handle>;
    363367    explicit GetPluginProcessConnection(const String& pluginPath)
    364368        : m_arguments(pluginPath)
     
    385389    using DelayedReply = CompletionHandler<void()>;
    386390    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
    387     typedef std::tuple<> Reply;
     391    using Reply = std::tuple<>;
     392    using ReplyArguments = std::tuple<>;
    388393    const Arguments& arguments() const
    389394    {
     
    494499    static const bool isSync = true;
    495500
    496     typedef std::tuple<Vector<WebCore::KeypressCommand>&> Reply;
     501    using Reply = std::tuple<Vector<WebCore::KeypressCommand>&>;
     502    using ReplyArguments = std::tuple<Vector<WebCore::KeypressCommand>>;
    497503    explicit InterpretKeyEvent(uint32_t type)
    498504        : m_arguments(type)
  • trunk/Source/WebKit/Scripts/webkit/Messages-expected.h

    r241622 r243460  
    289289    static const bool isSync = true;
    290290
    291     typedef std::tuple<bool&> Reply;
     291    using Reply = std::tuple<bool&>;
     292    using ReplyArguments = std::tuple<bool>;
    292293    CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters)
    293294        : m_arguments(pluginInstanceID, parameters)
     
    312313    static const bool isSync = true;
    313314
    314     typedef std::tuple<> Reply;
     315    using Reply = std::tuple<>;
     316    using ReplyArguments = std::tuple<>;
    315317    RunJavaScriptAlert(uint64_t frameID, const String& message)
    316318        : m_arguments(frameID, message)
     
    335337    static const bool isSync = true;
    336338
    337     typedef std::tuple<Vector<WebCore::PluginInfo>&> Reply;
     339    using Reply = std::tuple<Vector<WebCore::PluginInfo>&>;
     340    using ReplyArguments = std::tuple<Vector<WebCore::PluginInfo>>;
    338341    explicit GetPlugins(bool refresh)
    339342        : m_arguments(refresh)
     
    360363    using DelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
    361364    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const IPC::Connection::Handle& connectionHandle);
    362     typedef std::tuple<IPC::Connection::Handle&> Reply;
     365    using Reply = std::tuple<IPC::Connection::Handle&>;
     366    using ReplyArguments = std::tuple<IPC::Connection::Handle>;
    363367    explicit GetPluginProcessConnection(const String& pluginPath)
    364368        : m_arguments(pluginPath)
     
    385389    using DelayedReply = CompletionHandler<void()>;
    386390    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
    387     typedef std::tuple<> Reply;
     391    using Reply = std::tuple<>;
     392    using ReplyArguments = std::tuple<>;
    388393    const Arguments& arguments() const
    389394    {
     
    494499    static const bool isSync = true;
    495500
    496     typedef std::tuple<Vector<WebCore::KeypressCommand>&> Reply;
     501    using Reply = std::tuple<Vector<WebCore::KeypressCommand>&>;
     502    using ReplyArguments = std::tuple<Vector<WebCore::KeypressCommand>>;
    497503    explicit InterpretKeyEvent(uint32_t type)
    498504        : m_arguments(type)
  • trunk/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h

    r243345 r243460  
    8181    using AsyncReply = CompletionHandler<void(uint64_t result)>;
    8282    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint64_t result);
    83     typedef std::tuple<uint64_t&> Reply;
     83    using Reply = std::tuple<uint64_t&>;
     84    using ReplyArguments = std::tuple<uint64_t>;
    8485    explicit TestAsyncMessage(WebKit::TestTwoStateEnum twoStateEnum)
    8586        : m_arguments(twoStateEnum)
     
    111112    using AsyncReply = CompletionHandler<void()>;
    112113    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
    113     typedef std::tuple<> Reply;
     114    using Reply = std::tuple<>;
     115    using ReplyArguments = std::tuple<>;
    114116    const Arguments& arguments() const
    115117    {
     
    136138    using AsyncReply = CompletionHandler<void(bool flag, uint64_t value)>;
    137139    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool flag, uint64_t value);
    138     typedef std::tuple<bool&, uint64_t&> Reply;
     140    using Reply = std::tuple<bool&, uint64_t&>;
     141    using ReplyArguments = std::tuple<bool, uint64_t>;
    139142    const Arguments& arguments() const
    140143    {
     
    157160    using DelayedReply = CompletionHandler<void(uint8_t reply)>;
    158161    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint8_t reply);
    159     typedef std::tuple<uint8_t&> Reply;
     162    using Reply = std::tuple<uint8_t&>;
     163    using ReplyArguments = std::tuple<uint8_t>;
    160164    explicit TestSyncMessage(uint32_t param)
    161165        : m_arguments(param)
     
    182186    using DelayedReply = CompletionHandler<void(const Optional<WebKit::TestClassName>& optionalReply)>;
    183187    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const Optional<WebKit::TestClassName>& optionalReply);
    184     typedef std::tuple<Optional<WebKit::TestClassName>&> Reply;
     188    using Reply = std::tuple<Optional<WebKit::TestClassName>&>;
     189    using ReplyArguments = std::tuple<Optional<WebKit::TestClassName>>;
    185190    explicit TestSynchronousMessage(bool value)
    186191        : m_arguments(value)
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r243354 r243460  
    110110
    111111
     112def reply_arguments_type(message):
     113    return 'std::tuple<%s>' % (', '.join(parameter.type for parameter in message.reply_parameters))
     114
     115
    112116def message_to_struct_declaration(message):
    113117    result = []
     
    138142                result.append(', %s' % completion_handler_parameters)
    139143            result.append(');\n')
    140         result.append('    typedef %s Reply;\n' % reply_type(message))
     144        result.append('    using Reply = %s;\n' % reply_type(message))
     145        result.append('    using ReplyArguments = %s;\n' % reply_arguments_type(message))
    141146
    142147    if len(function_parameters):
  • trunk/Source/WebKit/Shared/Databases/IndexedDB/WebIDBResult.h

    r204668 r243460  
    5151    {
    5252    }
     53   
     54    WebIDBResult(WebIDBResult&&) = default;
     55    WebIDBResult& operator=(WebIDBResult&&) = default;
    5356
    5457    const WebCore::IDBResultData& resultData() const { return m_resultData; }
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h

    r243007 r243460  
    5050
    5151namespace WebKit {
    52 
    53 class PlatformCALayerRemote;
    5452
    5553class RemoteLayerTreeTransaction {
     
    178176    explicit RemoteLayerTreeTransaction();
    179177    ~RemoteLayerTreeTransaction();
     178    RemoteLayerTreeTransaction(RemoteLayerTreeTransaction&&);
     179    RemoteLayerTreeTransaction& operator=(RemoteLayerTreeTransaction&&);
    180180
    181181    void encode(IPC::Encoder&) const;
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm

    r243007 r243460  
    3939
    4040namespace WebKit {
     41
     42RemoteLayerTreeTransaction::RemoteLayerTreeTransaction(RemoteLayerTreeTransaction&&) = default;
     43RemoteLayerTreeTransaction& RemoteLayerTreeTransaction::operator=(RemoteLayerTreeTransaction&&) = default;
    4144
    4245RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties()
  • trunk/Source/WebKit/Shared/ShareableBitmap.h

    r221149 r243460  
    6464    public:
    6565        Handle();
     66        Handle(Handle&&) = default;
     67        Handle& operator=(Handle&&) = default;
    6668
    6769        bool isNull() const { return m_handle.isNull(); }
  • trunk/Source/WebKit/Shared/ShareableResource.h

    r204668 r243460  
    4646    public:
    4747        Handle();
     48        Handle(Handle&&) = default;
     49        Handle& operator=(Handle&&) = default;
    4850
    4951        bool isNull() const { return m_handle.isNull(); }
  • trunk/Source/WebKit/Shared/UpdateInfo.h

    r204668 r243460  
    4444public:
    4545    UpdateInfo() { }
     46    UpdateInfo(UpdateInfo&&) = default;
     47    UpdateInfo& operator=(UpdateInfo&&) = default;
    4648
    4749    void encode(IPC::Encoder&) const;
  • trunk/Source/WebKit/Shared/WebEvent.h

    r241183 r243460  
    2525 */
    2626
    27 #ifndef WebEvent_h
    28 #define WebEvent_h
     27#pragma once
    2928
    3029// FIXME: We should probably move to makeing the WebCore/PlatformFooEvents trivial classes so that
     
    3534#include <WebCore/IntPoint.h>
    3635#include <WebCore/IntSize.h>
     36#include <WebCore/KeypressCommand.h>
    3737#include <wtf/OptionSet.h>
    3838#include <wtf/WallTime.h>
     
    498498
    499499} // namespace WebKit
    500 
    501 #endif // WebEvent_h
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r243384 r243460  
    3535namespace WebKit {
    3636
     37WebProcessCreationParameters::WebProcessCreationParameters(WebProcessCreationParameters&&) = default;
     38WebProcessCreationParameters& WebProcessCreationParameters::operator=(WebProcessCreationParameters&&) = default;
     39
    3740WebProcessCreationParameters::WebProcessCreationParameters()
    3841{
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r243384 r243460  
    6666    WebProcessCreationParameters();
    6767    ~WebProcessCreationParameters();
     68    WebProcessCreationParameters(WebProcessCreationParameters&&);
     69    WebProcessCreationParameters& operator=(WebProcessCreationParameters&&);
    6870
    6971    void encode(IPC::Encoder&) const;
  • trunk/Source/WebKit/Shared/mac/SecItemResponseData.cpp

    r204668 r243460  
    3232namespace WebKit {
    3333
    34 SecItemResponseData::SecItemResponseData()
    35 {
    36 }
    37 
    38 SecItemResponseData::SecItemResponseData(OSStatus resultCode, CFTypeRef resultObject)
     34SecItemResponseData::SecItemResponseData(OSStatus resultCode, RetainPtr<CFTypeRef>&& resultObject)
    3935    : m_resultObject(resultObject)
    40     , m_resultCode(resultCode)
     36    , m_resultCode(WTFMove(resultCode))
    4137{
    4238}
     
    5046}
    5147
    52 bool SecItemResponseData::decode(IPC::Decoder& decoder, SecItemResponseData& secItemResponseData)
     48Optional<SecItemResponseData> SecItemResponseData::decode(IPC::Decoder& decoder)
    5349{
    5450    int64_t resultCode;
    5551    if (!decoder.decode(resultCode))
    56         return false;
    57     secItemResponseData.m_resultCode = (OSStatus)resultCode;
    58     secItemResponseData.m_resultObject = 0;
     52        return WTF::nullopt;
    5953
    6054    bool expectResultObject;
    6155    if (!decoder.decode(expectResultObject))
    62         return false;
     56        return WTF::nullopt;
    6357
    64     if (expectResultObject && !IPC::decode(decoder, secItemResponseData.m_resultObject))
    65         return false;
     58    RetainPtr<CFTypeRef> result;
     59    if (expectResultObject && !IPC::decode(decoder, result))
     60        return WTF::nullopt;
    6661
    67     return true;
     62    return {{ static_cast<OSStatus>(resultCode), WTFMove(result) }};
    6863}
    6964
  • trunk/Source/WebKit/Shared/mac/SecItemResponseData.h

    r204668 r243460  
    3838class SecItemResponseData {
    3939public:
    40     SecItemResponseData();
    41     SecItemResponseData(OSStatus, CFTypeRef result);
     40    SecItemResponseData(OSStatus, RetainPtr<CFTypeRef>&& result);
    4241
    4342    void encode(IPC::Encoder&) const;
    44     static bool decode(IPC::Decoder&, SecItemResponseData&);
     43    static Optional<SecItemResponseData> decode(IPC::Decoder&);
    4544
    4645    RetainPtr<CFTypeRef>& resultObject() { return m_resultObject; }
  • trunk/Source/WebKit/WebProcess/MediaStream/MediaDeviceSandboxExtensions.h

    r225926 r243460  
    4040    {
    4141    }
     42    MediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&) = default;
     43    MediaDeviceSandboxExtensions& operator=(MediaDeviceSandboxExtensions&&) = default;
    4244
    4345    MediaDeviceSandboxExtensions(Vector<String> ids, SandboxExtension::HandleArray&& handles);
Note: See TracChangeset for help on using the changeset viewer.