From ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 16 May 2011 16:25:10 +0100 Subject: Merge WebKit at r76408: Initial merge by git. Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53 --- Source/WebKit2/Platform/CoreIPC/Connection.h | 74 +++++++++++++--------- .../WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp | 4 +- Source/WebKit2/Platform/Module.h | 3 +- Source/WebKit2/Platform/SharedMemory.h | 3 +- 4 files changed, 49 insertions(+), 35 deletions(-) (limited to 'Source/WebKit2/Platform') diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h index b7e5b0f..1b009cf 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.h +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -115,23 +115,22 @@ public: void invalidate(); void markCurrentlyDispatchedMessageAsInvalid(); - // FIXME: This variant of send is deprecated, all clients should move to the overload that takes a message. - template bool send(E messageID, uint64_t destinationID, const T& arguments); - - template bool send(const T& message, uint64_t destinationID); - static const unsigned long long NoTimeout = 10000000000ULL; - // FIXME: This variant of sendSync is deprecated, all clients should move to the overload that takes a message. - template bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout); + template bool send(const T& message, uint64_t destinationID); template bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout); - - template PassOwnPtr waitFor(E messageID, uint64_t destinationID, double timeout); + template bool waitForAndDispatchImmediately(uint64_t destinationID, double timeout); PassOwnPtr createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID); bool sendMessage(MessageID, PassOwnPtr); bool sendSyncReply(PassOwnPtr); + // FIXME: These variants of senc, sendSync and waitFor are all deprecated. + // All clients should move to the overloads that take a message type. + template bool send(E messageID, uint64_t destinationID, const T& arguments); + template bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout); + template PassOwnPtr waitFor(E messageID, uint64_t destinationID, double timeout); + private: template class Message { public: @@ -300,15 +299,6 @@ private: #endif }; -template -bool Connection::send(E messageID, uint64_t destinationID, const T& arguments) -{ - OwnPtr argumentEncoder = ArgumentEncoder::create(destinationID); - argumentEncoder->encode(arguments); - - return sendMessage(MessageID(messageID), argumentEncoder.release()); -} - template bool Connection::send(const T& message, uint64_t destinationID) { OwnPtr argumentEncoder = ArgumentEncoder::create(destinationID); @@ -317,6 +307,36 @@ template bool Connection::send(const T& message, uint64_t destinatio return sendMessage(MessageID(T::messageID), argumentEncoder.release()); } +template bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout) +{ + uint64_t syncRequestID = 0; + OwnPtr argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID); + + // Encode the rest of the input arguments. + argumentEncoder->encode(message); + + // Now send the message and wait for a reply. + OwnPtr replyDecoder = sendSyncMessage(MessageID(T::messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout); + if (!replyDecoder) + return false; + + // Decode the reply. + return replyDecoder->decode(const_cast(reply)); +} + +template bool Connection::waitForAndDispatchImmediately(uint64_t destinationID, double timeout) +{ + OwnPtr decoder = waitForMessage(MessageID(T::messageID), destinationID, timeout); + if (!decoder) + return false; + + ASSERT(decoder->destinationID() == destinationID); + m_client->didReceiveMessage(this, MessageID(T::messageID), decoder.get()); + return true; +} + +// These three member functions are all deprecated. + template inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) { @@ -335,21 +355,13 @@ inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& a return replyDecoder->decode(const_cast(reply)); } -template bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout) +template +bool Connection::send(E messageID, uint64_t destinationID, const T& arguments) { - uint64_t syncRequestID = 0; - OwnPtr argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID); - - // Encode the rest of the input arguments. - argumentEncoder->encode(message); - - // Now send the message and wait for a reply. - OwnPtr replyDecoder = sendSyncMessage(MessageID(T::messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout); - if (!replyDecoder) - return false; + OwnPtr argumentEncoder = ArgumentEncoder::create(destinationID); + argumentEncoder->encode(arguments); - // Decode the reply. - return replyDecoder->decode(const_cast(reply)); + return sendMessage(MessageID(messageID), argumentEncoder.release()); } template inline PassOwnPtr Connection::waitFor(E messageID, uint64_t destinationID, double timeout) diff --git a/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp index 65b1254..d561110 100644 --- a/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp +++ b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp @@ -41,7 +41,7 @@ static const size_t initialMessageBufferSize = 4096; static int readBytesFromSocket(int fileDescriptor, uint8_t* ptr, size_t length) { ASSERT(fileDescriptor > 0); - ASSERT(buffer); + ASSERT(ptr); ASSERT(length > 0); ssize_t numberOfBytesRead = 0; @@ -69,7 +69,7 @@ static int readBytesFromSocket(int fileDescriptor, uint8_t* ptr, size_t length) static bool writeBytesToSocket(int fileDescriptor, uint8_t* ptr, size_t length) { ASSERT(fileDescriptor > 0); - ASSERT(buffer); + ASSERT(ptr); ASSERT(length > 0); ssize_t numberOfBytesWritten = 0; diff --git a/Source/WebKit2/Platform/Module.h b/Source/WebKit2/Platform/Module.h index 0825bf6..ec7523c 100644 --- a/Source/WebKit2/Platform/Module.h +++ b/Source/WebKit2/Platform/Module.h @@ -39,7 +39,8 @@ namespace WebKit { -class Module : public Noncopyable { +class Module { + WTF_MAKE_NONCOPYABLE(Module); public: Module(const String& path); ~Module(); diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h index 05dc0dd..9854132 100644 --- a/Source/WebKit2/Platform/SharedMemory.h +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -52,7 +52,8 @@ public: ReadWrite }; - class Handle : Noncopyable { + class Handle { + WTF_MAKE_NONCOPYABLE(Handle); public: Handle(); ~Handle(); -- cgit v1.1