diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:56:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:57:30 +0200 |
commit | b297e0fa5c217c9467033b7c8b46891a52870120 (patch) | |
tree | 43fc14689295e9e64f2719d05aad94e3049f6cd7 /Source/WebKit2/Shared | |
parent | 69d517dbfa69903d8593cc1737f0474b21e3251e (diff) | |
download | qtwebkit-b297e0fa5c217c9467033b7c8b46891a52870120.tar.gz |
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78.
Caused OOM issues on some CI machines :(
Diffstat (limited to 'Source/WebKit2/Shared')
41 files changed, 355 insertions, 775 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKArray.cpp b/Source/WebKit2/Shared/API/c/WKArray.cpp index 5bf35e3c3..6ca9af273 100644 --- a/Source/WebKit2/Shared/API/c/WKArray.cpp +++ b/Source/WebKit2/Shared/API/c/WKArray.cpp @@ -42,12 +42,6 @@ WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues) return toAPI(array.release().leakRef()); } -WKArrayRef WKArrayCreateAdoptingValues(WKTypeRef* values, size_t numberOfValues) -{ - RefPtr<ImmutableArray> array = ImmutableArray::adopt(reinterpret_cast<APIObject**>(const_cast<void**>(values)), numberOfValues); - return toAPI(array.release().leakRef()); -} - WKTypeRef WKArrayGetItemAtIndex(WKArrayRef arrayRef, size_t index) { return toImpl(arrayRef)->at(index); diff --git a/Source/WebKit2/Shared/API/c/WKArray.h b/Source/WebKit2/Shared/API/c/WKArray.h index 25900f313..da4560a0a 100644 --- a/Source/WebKit2/Shared/API/c/WKArray.h +++ b/Source/WebKit2/Shared/API/c/WKArray.h @@ -37,7 +37,6 @@ extern "C" { WK_EXPORT WKTypeID WKArrayGetTypeID(); WK_EXPORT WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues); -WK_EXPORT WKArrayRef WKArrayCreateAdoptingValues(WKTypeRef* values, size_t numberOfValues); WK_EXPORT WKTypeRef WKArrayGetItemAtIndex(WKArrayRef array, size_t index); WK_EXPORT size_t WKArrayGetSize(WKArrayRef array); diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index 1a2761024..ab6ca84cd 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -79,18 +79,6 @@ typedef const struct OpaqueWKURLRequest* WKURLRequestRef; typedef const struct OpaqueWKURLResponse* WKURLResponseRef; typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef; -enum WKUserContentInjectedFrames { - kWKInjectInAllFrames, - kWKInjectInTopFrameOnly -}; -typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames; - -enum WKUserScriptInjectionTime { - kWKInjectAtDocumentStart, - kWKInjectAtDocumentEnd -}; -typedef enum WKUserScriptInjectionTime WKUserScriptInjectionTime; - /* WebKit2 main API types */ typedef const struct OpaqueWKApplicationCacheManager* WKApplicationCacheManagerRef; diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index 86940ffed..94a77e176 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -48,8 +48,6 @@ #include <WebCore/FrameLoaderTypes.h> #include <WebCore/IntRect.h> #include <WebCore/LayoutMilestones.h> -#include <WebCore/UserContentTypes.h> -#include <WebCore/UserScriptTypes.h> #include <wtf/TypeTraits.h> namespace WebKit { @@ -813,32 +811,6 @@ inline SnapshotOptions toSnapshotOptions(WKSnapshotOptions wkSnapshotOptions) return snapshotOptions; } -inline WebCore::UserScriptInjectionTime toUserScriptInjectionTime(WKUserScriptInjectionTime wkInjectedTime) -{ - switch (wkInjectedTime) { - case kWKInjectAtDocumentStart: - return WebCore::InjectAtDocumentStart; - case kWKInjectAtDocumentEnd: - return WebCore::InjectAtDocumentEnd; - } - - ASSERT_NOT_REACHED(); - return WebCore::InjectAtDocumentStart; -} - -inline WebCore::UserContentInjectedFrames toUserContentInjectedFrames(WKUserContentInjectedFrames wkInjectedFrames) -{ - switch (wkInjectedFrames) { - case kWKInjectInAllFrames: - return WebCore::InjectInAllFrames; - case kWKInjectInTopFrameOnly: - return WebCore::InjectInTopFrameOnly; - } - - ASSERT_NOT_REACHED(); - return WebCore::InjectInAllFrames; -} - } // namespace WebKit #endif // WKSharedAPICast_h diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp index 875ad3df5..2d25f282a 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp @@ -51,13 +51,3 @@ int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef responseRef) { return toImpl(responseRef)->resourceResponse().httpStatusCode(); } - -WKStringRef WKURLResponseCopySuggestedFilename(WKURLResponseRef responseRef) -{ - return toCopiedAPI(toImpl(responseRef)->resourceResponse().suggestedFilename()); -} - -bool WKURLResponseIsAttachment(WKURLResponseRef responseRef) -{ - return toImpl(responseRef)->resourceResponse().isAttachment(); -} diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.h b/Source/WebKit2/Shared/API/c/WKURLResponse.h index 08f91d4f3..d4c269340 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.h +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.h @@ -40,10 +40,6 @@ WK_EXPORT WKStringRef WKURLResponseCopyMIMEType(WKURLResponseRef); WK_EXPORT int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef); -WK_EXPORT WKStringRef WKURLResponseCopySuggestedFilename(WKURLResponseRef); - -WK_EXPORT bool WKURLResponseIsAttachment(WKURLResponseRef); - #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp index 4e40bdf4e..e1d4ee7bb 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp @@ -38,9 +38,6 @@ using namespace WebKit; WKURLRef WKURLCreateWithCFURL(CFURLRef cfURL) { - if (!cfURL) - return 0; - String urlString(CFURLGetString(cfURL)); return toCopiedURLAPI(urlString); } diff --git a/Source/WebKit2/Shared/APIClientTraits.cpp b/Source/WebKit2/Shared/APIClientTraits.cpp index eb7a51bfa..76f13ad1f 100644 --- a/Source/WebKit2/Shared/APIClientTraits.cpp +++ b/Source/WebKit2/Shared/APIClientTraits.cpp @@ -40,7 +40,6 @@ const size_t APIClientTraits<WKBundlePageLoaderClient>::interfaceSizesByVersion[ offsetof(WKBundlePageLoaderClient, didLayoutForFrame), offsetof(WKBundlePageLoaderClient, didFinishProgress), offsetof(WKBundlePageLoaderClient, didReceiveIntentForFrame), - offsetof(WKBundlePageLoaderClient, registerIntentServiceForFrame), sizeof(WKBundlePageLoaderClient) }; @@ -87,9 +86,4 @@ const size_t APIClientTraits<WKContextInjectedBundleClient>::interfaceSizesByVer sizeof(WKContextInjectedBundleClient) }; -const size_t APIClientTraits<WKIconDatabaseClient>::interfaceSizesByVersion[] = { - offsetof(WKIconDatabaseClient, iconDataReadyForPageURL), - sizeof(WKIconDatabaseClient) -}; - } // namespace WebKit diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h index 4ad4fb1b2..9b7663d0a 100644 --- a/Source/WebKit2/Shared/APIClientTraits.h +++ b/Source/WebKit2/Shared/APIClientTraits.h @@ -29,7 +29,6 @@ #include "WKBundle.h" #include "WKBundlePage.h" #include "WKContext.h" -#include "WKIconDatabase.h" #include "WKPage.h" namespace WebKit { @@ -44,7 +43,7 @@ template<> struct APIClientTraits<WKBundleClient> { }; template<> struct APIClientTraits<WKBundlePageLoaderClient> { - static const size_t interfaceSizesByVersion[5]; + static const size_t interfaceSizesByVersion[4]; }; template<> struct APIClientTraits<WKBundlePageResourceLoadClient> { @@ -79,10 +78,6 @@ template<> struct APIClientTraits<WKContextInjectedBundleClient> { static const size_t interfaceSizesByVersion[2]; }; -template<> struct APIClientTraits<WKIconDatabaseClient> { - static const size_t interfaceSizesByVersion[2]; -}; - } // namespace WebKit #endif // APIClientTraits_h diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h b/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h index 4f59e2941..a1afd6987 100644 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h +++ b/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,33 +23,28 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef NetworkProcessCreationParameters_h -#define NetworkProcessCreationParameters_h +#ifndef InjectedBundleMessageKinds_h +#define InjectedBundleMessageKinds_h -#if ENABLE(NETWORK_PROCESS) +// Messages sent from WebKit to the injected bundle. -#include <wtf/text/WTFString.h> +#include "MessageID.h" -namespace CoreIPC { - class ArgumentDecoder; - class ArgumentEncoder; -} +namespace InjectedBundleMessage { -namespace WebKit { +enum Kind { + PostMessage, + PostMessageToPage +}; -struct NetworkProcessCreationParameters { - NetworkProcessCreationParameters(); +} - void encode(CoreIPC::ArgumentEncoder*) const; - static bool decode(CoreIPC::ArgumentDecoder*, NetworkProcessCreationParameters&); +namespace CoreIPC { -#if PLATFORM(MAC) - String parentProcessName; -#endif +template<> struct MessageKindTraits<InjectedBundleMessage::Kind> { + static const MessageClass messageClass = MessageClassInjectedBundle; }; -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) +} -#endif // NetworkProcessCreationParameters_h +#endif // InjectedBundleMessageKinds_h diff --git a/Source/WebKit2/Shared/ImmutableArray.cpp b/Source/WebKit2/Shared/ImmutableArray.cpp index 2d45ae9be..67b2a34c5 100644 --- a/Source/WebKit2/Shared/ImmutableArray.cpp +++ b/Source/WebKit2/Shared/ImmutableArray.cpp @@ -32,13 +32,6 @@ ImmutableArray::ImmutableArray() { } -ImmutableArray::ImmutableArray(AdoptTag, APIObject** entries, size_t size) - : m_entries(size) -{ - for (size_t i = 0; i < size; ++i) - m_entries[i] = adoptRef(entries[i]); -} - ImmutableArray::ImmutableArray(APIObject** entries, size_t size) : m_entries(size) { diff --git a/Source/WebKit2/Shared/ImmutableArray.h b/Source/WebKit2/Shared/ImmutableArray.h index d2208cdc4..e26e4aa5d 100644 --- a/Source/WebKit2/Shared/ImmutableArray.h +++ b/Source/WebKit2/Shared/ImmutableArray.h @@ -38,7 +38,6 @@ namespace WebKit { class ImmutableArray : public APIObject { public: static const Type APIType = TypeArray; - enum AdoptTag { Adopt }; static PassRefPtr<ImmutableArray> create() { @@ -48,10 +47,6 @@ public: { return adoptRef(new ImmutableArray(entries, size)); } - static PassRefPtr<ImmutableArray> adopt(APIObject** entries, size_t size) - { - return adoptRef(new ImmutableArray(Adopt, entries, size)); - } static PassRefPtr<ImmutableArray> adopt(Vector<RefPtr<APIObject> >& entries) { return adoptRef(new ImmutableArray(entries)); @@ -69,8 +64,7 @@ public: protected: ImmutableArray(); - ImmutableArray(AdoptTag, APIObject** entries, size_t); - ImmutableArray(APIObject** entries, size_t); + ImmutableArray(APIObject** entries, size_t size); ImmutableArray(Vector<RefPtr<APIObject> >& entries); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp b/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp deleted file mode 100644 index efbe3572d..000000000 --- a/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "NetworkProcessCreationParameters.h" - -#if ENABLE(NETWORK_PROCESS) - -#include "ArgumentCoders.h" - -namespace WebKit { - -NetworkProcessCreationParameters::NetworkProcessCreationParameters() -{ -} - -void NetworkProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const -{ -#if PLATFORM(MAC) - encoder->encode(parentProcessName); -#endif -} - -bool NetworkProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, NetworkProcessCreationParameters& result) -{ -#if PLATFORM(MAC) - if (!decoder->decode(result.parentProcessName)) - return false; -#endif - - return true; -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp index b5ec2d9da..7641af5e8 100644 --- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp @@ -200,7 +200,7 @@ void NPRemoteObjectMap::pluginDestroyed(Plugin* plugin) // Gather the receivers associated with this plug-in. for (HashMap<uint64_t, NPObjectMessageReceiver*>::const_iterator it = m_registeredNPObjects.begin(), end = m_registeredNPObjects.end(); it != end; ++it) { - NPObjectMessageReceiver* npObjectMessageReceiver = it->value; + NPObjectMessageReceiver* npObjectMessageReceiver = it->second; if (npObjectMessageReceiver->plugin() == plugin) messageReceivers.append(npObjectMessageReceiver); } diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm index 81b38e0ec..a4635e035 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -93,11 +93,14 @@ static bool getPluginArchitecture(CFBundleRef bundle, PluginModuleInfo& plugin) static RetainPtr<CFDictionaryRef> contentsOfPropertyListAtURL(CFURLRef propertyListURL) { - RetainPtr<NSData> propertyListData = adoptNS([[NSData alloc] initWithContentsOfURL:(NSURL *)propertyListURL]); + CFDataRef propertyListData; + CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, propertyListURL, &propertyListData, 0, 0, 0); if (!propertyListData) return 0; - RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(kCFAllocatorDefault, (CFDataRef)propertyListData.get(), kCFPropertyListImmutable, 0, 0)); + RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(kCFAllocatorDefault, propertyListData, kCFPropertyListImmutable, 0, 0)); + CFRelease(propertyListData); + if (!propertyList) return 0; diff --git a/Source/WebKit2/Shared/ShareableSurface.cpp b/Source/WebKit2/Shared/ShareableSurface.cpp index be093e0c0..43bd525b4 100644 --- a/Source/WebKit2/Shared/ShareableSurface.cpp +++ b/Source/WebKit2/Shared/ShareableSurface.cpp @@ -22,7 +22,6 @@ #include "GraphicsContext.h" #include "WebCoreArgumentCoders.h" -#include <WebCore/GraphicsSurfaceToken.h> #if USE(TEXTURE_MAPPER) #include "TextureMapperGL.h" @@ -33,6 +32,9 @@ using namespace WebCore; namespace WebKit { ShareableSurface::Handle::Handle() +#if USE(GRAPHICS_SURFACE) + : m_graphicsSurfaceToken(0) +#endif { } @@ -42,7 +44,7 @@ void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(m_flags); #if USE(GRAPHICS_SURFACE) encoder->encode(m_graphicsSurfaceToken); - if (m_graphicsSurfaceToken.isValid()) + if (m_graphicsSurfaceToken) return; #endif encoder->encode(m_bitmapHandle); @@ -57,7 +59,7 @@ bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& #if USE(GRAPHICS_SURFACE) if (!decoder->decode(handle.m_graphicsSurfaceToken)) return false; - if (handle.m_graphicsSurfaceToken.isValid()) + if (handle.m_graphicsSurfaceToken) return true; #endif if (!decoder->decode(handle.m_bitmapHandle)) @@ -149,7 +151,7 @@ ShareableSurface::~ShareableSurface() PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle) { #if USE(GRAPHICS_SURFACE) - if (handle.graphicsSurfaceToken().isValid()) { + if (handle.graphicsSurfaceToken()) { RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken); if (surface) return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface))); @@ -169,8 +171,8 @@ bool ShareableSurface::createHandle(Handle& handle) handle.m_flags = m_flags; #if USE(GRAPHICS_SURFACE) - handle.m_graphicsSurfaceToken = m_graphicsSurface ? m_graphicsSurface->exportToken() : GraphicsSurfaceToken(); - if (handle.m_graphicsSurfaceToken.isValid()) + handle.m_graphicsSurfaceToken = m_graphicsSurface ? m_graphicsSurface->exportToken() : 0; + if (handle.m_graphicsSurfaceToken) return true; #endif if (!m_bitmap->createHandle(handle.m_bitmapHandle)) diff --git a/Source/WebKit2/Shared/ShareableSurface.h b/Source/WebKit2/Shared/ShareableSurface.h index 598dc5911..b685b0777 100644 --- a/Source/WebKit2/Shared/ShareableSurface.h +++ b/Source/WebKit2/Shared/ShareableSurface.h @@ -55,14 +55,14 @@ public: static bool decode(CoreIPC::ArgumentDecoder*, Handle&); #if USE(GRAPHICS_SURFACE) - WebCore::GraphicsSurfaceToken graphicsSurfaceToken() const { return m_graphicsSurfaceToken; } + uint64_t graphicsSurfaceToken() const { return m_graphicsSurfaceToken; } #endif private: friend class ShareableSurface; mutable ShareableBitmap::Handle m_bitmapHandle; #if USE(GRAPHICS_SURFACE) - WebCore::GraphicsSurfaceToken m_graphicsSurfaceToken; + uint64_t m_graphicsSurfaceToken; #endif WebCore::IntSize m_size; ShareableBitmap::Flags m_flags; diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h index 2ec5bb4d5..ee4ab64ff 100644 --- a/Source/WebKit2/Shared/UserMessageCoders.h +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -93,8 +93,8 @@ public: ImmutableDictionary::MapType::const_iterator it = map.begin(); ImmutableDictionary::MapType::const_iterator end = map.end(); for (; it != end; ++it) { - encoder->encode(it->key); - encoder->encode(Owner(it->value.get())); + encoder->encode(it->first); + encoder->encode(Owner(it->second.get())); } return true; } diff --git a/Source/WebKit2/Shared/WebConnection.cpp b/Source/WebKit2/Shared/WebConnection.cpp index d941318db..9530e2474 100644 --- a/Source/WebKit2/Shared/WebConnection.cpp +++ b/Source/WebKit2/Shared/WebConnection.cpp @@ -26,19 +26,8 @@ #include "config.h" #include "WebConnection.h" -#include "ArgumentCoders.h" -#include "Connection.h" -#include "DataReference.h" -#include "WebConnectionMessages.h" -#include <wtf/text/WTFString.h> - namespace WebKit { -WebConnection::WebConnection(PassRefPtr<CoreIPC::Connection> connection) - : m_connection(connection) -{ -} - WebConnection::~WebConnection() { } @@ -48,37 +37,9 @@ void WebConnection::initializeConnectionClient(const WKConnectionClient* client) m_client.initialize(client); } -void WebConnection::postMessage(const String& messageName, APIObject* messageBody) -{ - if (!m_connection) - return; - - OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(0); - messageData->encode(messageName); - encodeMessageBody(messageData.get(), messageBody); - - m_connection->send(Messages::WebConnection::HandleMessage(CoreIPC::DataReference(messageData->buffer(), messageData->bufferSize())), 0); -} - -void WebConnection::handleMessage(const CoreIPC::DataReference& messageData) -{ - CoreIPC::ArgumentDecoder messageDecoder(messageData.data(), messageData.size()); - - String messageName; - if (!messageDecoder.decode(messageName)) - return; - - RefPtr<APIObject> messageBody; - if (!decodeMessageBody(&messageDecoder, messageBody)) - return; - - m_client.didReceiveMessage(this, messageName, messageBody.get()); -} - -void WebConnection::invalidate() +void WebConnection::forwardDidReceiveMessageToClient(const String& messageName, APIObject* messageBody) { - m_connection->invalidate(); - m_connection = nullptr; + m_client.didReceiveMessage(this, messageName, messageBody); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebConnection.h b/Source/WebKit2/Shared/WebConnection.h index 3abd14d46..216e37c55 100644 --- a/Source/WebKit2/Shared/WebConnection.h +++ b/Source/WebKit2/Shared/WebConnection.h @@ -28,42 +28,26 @@ #include "APIObject.h" #include "WebConnectionClient.h" -#include <wtf/RefPtr.h> - -namespace CoreIPC { - class ArgumentDecoder; - class ArgumentEncoder; - class Connection; - class DataReference; - class MessageID; -} +#include <wtf/Forward.h> namespace WebKit { class WebConnection : public APIObject { public: static const Type APIType = TypeConnection; - virtual ~WebConnection(); - CoreIPC::Connection* connection() { return m_connection.get(); } + virtual ~WebConnection(); + // Initialize the connection client. void initializeConnectionClient(const WKConnectionClient*); - void postMessage(const String&, APIObject*); - void invalidate(); + virtual void postMessage(const String&, APIObject*) = 0; protected: - explicit WebConnection(PassRefPtr<CoreIPC::Connection>); - virtual Type type() const { return APIType; } - virtual void encodeMessageBody(CoreIPC::ArgumentEncoder*, APIObject*) = 0; - virtual bool decodeMessageBody(CoreIPC::ArgumentDecoder*, RefPtr<APIObject>&) = 0; - // Implemented in generated WebConnectionMessageReceiver.cpp - void didReceiveWebConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - void handleMessage(const CoreIPC::DataReference& messageData); + void forwardDidReceiveMessageToClient(const String&, APIObject*); - RefPtr<CoreIPC::Connection> m_connection; WebConnectionClient m_client; }; diff --git a/Source/WebKit2/Shared/WebConnection.messages.in b/Source/WebKit2/Shared/WebConnection.messages.in deleted file mode 100644 index 6e17707e1..000000000 --- a/Source/WebKit2/Shared/WebConnection.messages.in +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2010 Apple Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -messages -> WebConnection { - HandleMessage(CoreIPC::DataReference messageData) -} diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index c25ea9511..cbf624926 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -41,12 +41,7 @@ #include <WebCore/KURL.h> #include <WebCore/PluginData.h> #include <WebCore/ProtectionSpace.h> -#include <WebCore/ResourceError.h> -#include <WebCore/ResourceRequest.h> -#include <WebCore/ResourceResponse.h> #include <WebCore/TextCheckerClient.h> -#include <WebCore/UserScript.h> -#include <WebCore/UserStyleSheet.h> #include <WebCore/ViewportArguments.h> #include <WebCore/WindowFeatures.h> #include <wtf/text/StringHash.h> @@ -60,9 +55,6 @@ #if ENABLE(CSS_FILTERS) #include <WebCore/FilterOperations.h> #endif -#if USE(GRAPHICS_SURFACE) -#include <WebCore/GraphicsSurface.h> -#endif #endif using namespace WebCore; @@ -392,212 +384,6 @@ bool ArgumentCoder<Cursor>::decode(ArgumentDecoder* decoder, Cursor& cursor) return true; } -void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) -{ - if (kShouldSerializeWebCoreData) { - encoder->encode(resourceRequest.url().string()); - encoder->encode(resourceRequest.httpMethod()); - - const HTTPHeaderMap& headers = resourceRequest.httpHeaderFields(); - encoder->encode(headers); - - FormData* httpBody = resourceRequest.httpBody(); - encoder->encode(static_cast<bool>(httpBody)); - if (httpBody) - encoder->encode(httpBody->flattenToString()); - - encoder->encode(resourceRequest.firstPartyForCookies().string()); - } - - encodePlatformData(encoder, resourceRequest); -} - -bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) -{ - if (kShouldSerializeWebCoreData) { - ResourceRequest request; - - String url; - if (!decoder->decode(url)) - return false; - request.setURL(KURL(KURL(), url)); - - String httpMethod; - if (!decoder->decode(httpMethod)) - return false; - request.setHTTPMethod(httpMethod); - - HTTPHeaderMap headers; - if (!decoder->decode(headers)) - return false; - request.addHTTPHeaderFields(headers); - - bool hasHTTPBody; - if (!decoder->decode(hasHTTPBody)) - return false; - if (hasHTTPBody) { - String httpBody; - if (!decoder->decode(httpBody)) - return false; - request.setHTTPBody(FormData::create(httpBody.utf8())); - } - - String firstPartyForCookies; - if (!decoder->decode(firstPartyForCookies)) - return false; - request.setFirstPartyForCookies(KURL(KURL(), firstPartyForCookies)); - - resourceRequest = request; - } - - return decodePlatformData(decoder, resourceRequest); -} - -void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) -{ - if (kShouldSerializeWebCoreData) { - bool responseIsNull = resourceResponse.isNull(); - encoder->encode(responseIsNull); - if (responseIsNull) - return; - - encoder->encode(resourceResponse.url().string()); - encoder->encode(static_cast<int32_t>(resourceResponse.httpStatusCode())); - - const HTTPHeaderMap& headers = resourceResponse.httpHeaderFields(); - encoder->encode(headers); - - encoder->encode(resourceResponse.mimeType()); - encoder->encode(resourceResponse.textEncodingName()); - encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength())); - encoder->encode(resourceResponse.httpStatusText()); - encoder->encode(resourceResponse.suggestedFilename()); - } - - encodePlatformData(encoder, resourceResponse); -} - -bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) -{ - if (kShouldSerializeWebCoreData) { - bool responseIsNull; - if (!decoder->decode(responseIsNull)) - return false; - if (responseIsNull) { - resourceResponse = ResourceResponse(); - return true; - } - - ResourceResponse response; - - String url; - if (!decoder->decode(url)) - return false; - response.setURL(KURL(KURL(), url)); - - int32_t httpStatusCode; - if (!decoder->decode(httpStatusCode)) - return false; - response.setHTTPStatusCode(httpStatusCode); - - HTTPHeaderMap headers; - if (!decoder->decode(headers)) - return false; - for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) - response.setHTTPHeaderField(it->key, it->value); - - String mimeType; - if (!decoder->decode(mimeType)) - return false; - response.setMimeType(mimeType); - - String textEncodingName; - if (!decoder->decode(textEncodingName)) - return false; - response.setTextEncodingName(textEncodingName); - - int64_t contentLength; - if (!decoder->decode(contentLength)) - return false; - response.setExpectedContentLength(contentLength); - - String httpStatusText; - if (!decoder->decode(httpStatusText)) - return false; - response.setHTTPStatusText(httpStatusText); - - String suggestedFilename; - if (!decoder->decode(suggestedFilename)) - return false; - response.setSuggestedFilename(suggestedFilename); - - resourceResponse = response; - } - - return decodePlatformData(decoder, resourceResponse); -} - -void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) -{ - if (kShouldSerializeWebCoreData) { - bool errorIsNull = resourceError.isNull(); - encoder->encode(errorIsNull); - if (errorIsNull) - return; - - encoder->encode(resourceError.domain()); - encoder->encode(resourceError.errorCode()); - encoder->encode(resourceError.failingURL()); - encoder->encode(resourceError.localizedDescription()); - encoder->encode(resourceError.isCancellation()); - encoder->encode(resourceError.isTimeout()); - } - - encodePlatformData(encoder, resourceError); -} - -bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) -{ - if (kShouldSerializeWebCoreData) { - bool errorIsNull; - if (!decoder->decode(errorIsNull)) - return false; - if (errorIsNull) { - resourceError = ResourceError(); - return true; - } - - String domain; - if (!decoder->decode(domain)) - return false; - - int errorCode; - if (!decoder->decode(errorCode)) - return false; - - String failingURL; - if (!decoder->decode(failingURL)) - return false; - - String localizedDescription; - if (!decoder->decode(localizedDescription)) - return false; - - bool isCancellation; - if (!decoder->decode(isCancellation)) - return false; - - bool isTimeout; - if (!decoder->decode(isTimeout)) - return false; - - resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); - resourceError.setIsCancellation(isCancellation); - resourceError.setIsTimeout(isTimeout); - } - - return decodePlatformData(decoder, resourceError); -} void ArgumentCoder<WindowFeatures>::encode(ArgumentEncoder* encoder, const WindowFeatures& windowFeatures) { @@ -1009,115 +795,6 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, } #endif -#if USE(GRAPHICS_SURFACE) -void ArgumentCoder<WebCore::GraphicsSurfaceToken>::encode(ArgumentEncoder* encoder, const WebCore::GraphicsSurfaceToken& token) -{ -#if OS(DARWIN) - encoder->encodeUInt32(token.frontBufferHandle); - encoder->encodeUInt32(token.backBufferHandle); -#endif -#if OS(LINUX) - encoder->encodeUInt32(token.frontBufferHandle); -#endif -} - -bool ArgumentCoder<WebCore::GraphicsSurfaceToken>::decode(ArgumentDecoder* decoder, WebCore::GraphicsSurfaceToken& token) -{ -#if OS(DARWIN) - if (!decoder->decodeUInt32(token.frontBufferHandle)) - return false; - if (!decoder->decodeUInt32(token.backBufferHandle)) - return false; -#endif -#if OS(LINUX) - if (!decoder->decodeUInt32(token.frontBufferHandle)) - return false; -#endif - return true; -} - -#endif - #endif -void ArgumentCoder<WebCore::UserStyleSheet>::encode(ArgumentEncoder* encoder, const WebCore::UserStyleSheet& userStyleSheet) -{ - encoder->encode(userStyleSheet.source()); - encoder->encode(userStyleSheet.url()); - encoder->encode(userStyleSheet.whitelist()); - encoder->encode(userStyleSheet.blacklist()); - encoder->encodeEnum(userStyleSheet.injectedFrames()); - encoder->encodeEnum(userStyleSheet.level()); -} - -bool ArgumentCoder<WebCore::UserStyleSheet>::decode(ArgumentDecoder* decoder, WebCore::UserStyleSheet& userStyleSheet) -{ - String source; - if (!decoder->decode(source)) - return false; - - KURL url; - if (!decoder->decode(url)) - return false; - - Vector<String> whitelist; - if (!decoder->decode(whitelist)) - return false; - - Vector<String> blacklist; - if (!decoder->decode(blacklist)) - return false; - - WebCore::UserContentInjectedFrames injectedFrames; - if (!decoder->decodeEnum(injectedFrames)) - return false; - - WebCore::UserStyleLevel level; - if (!decoder->decodeEnum(level)) - return false; - - userStyleSheet = WebCore::UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level); - return true; -} - -void ArgumentCoder<WebCore::UserScript>::encode(ArgumentEncoder* encoder, const WebCore::UserScript& userScript) -{ - encoder->encode(userScript.source()); - encoder->encode(userScript.url()); - encoder->encode(userScript.whitelist()); - encoder->encode(userScript.blacklist()); - encoder->encodeEnum(userScript.injectionTime()); - encoder->encodeEnum(userScript.injectedFrames()); -} - -bool ArgumentCoder<WebCore::UserScript>::decode(ArgumentDecoder* decoder, WebCore::UserScript& userScript) -{ - String source; - if (!decoder->decode(source)) - return false; - - KURL url; - if (!decoder->decode(url)) - return false; - - Vector<String> whitelist; - if (!decoder->decode(whitelist)) - return false; - - Vector<String> blacklist; - if (!decoder->decode(blacklist)) - return false; - - WebCore::UserScriptInjectionTime injectionTime; - if (!decoder->decodeEnum(injectionTime)) - return false; - - WebCore::UserContentInjectedFrames injectedFrames; - if (!decoder->decodeEnum(injectedFrames)) - return false; - - userScript = WebCore::UserScript(source, url, whitelist, blacklist, injectionTime, injectedFrames); - return true; -} - } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index 581058cab..b08f118f9 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -49,8 +49,6 @@ namespace WebCore { class ResourceError; class ResourceRequest; class ResourceResponse; - class UserStyleSheet; - class UserScript; struct CompositionUnderline; struct DictationAlternative; struct DragSession; @@ -74,10 +72,6 @@ namespace WebCore { class FloatPoint3D; class TransformationMatrix; struct Length; - -#if USE(GRAPHICS_SURFACE) - struct GraphicsSurfaceToken; -#endif } #if ENABLE(CSS_FILTERS) @@ -165,42 +159,17 @@ template<> struct ArgumentCoder<WebCore::Cursor> { }; template<> struct ArgumentCoder<WebCore::ResourceRequest> { -#if PLATFORM(MAC) || PLATFORM(WIN) - static const bool kShouldSerializeWebCoreData = false; -#else - static const bool kShouldSerializeWebCoreData = true; -#endif - static void encode(ArgumentEncoder*, const WebCore::ResourceRequest&); static bool decode(ArgumentDecoder*, WebCore::ResourceRequest&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceRequest&); - static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceRequest&); }; template<> struct ArgumentCoder<WebCore::ResourceResponse> { -#if PLATFORM(MAC) || PLATFORM(WIN) - static const bool kShouldSerializeWebCoreData = false; -#else - static const bool kShouldSerializeWebCoreData = true; -#endif - static void encode(ArgumentEncoder*, const WebCore::ResourceResponse&); static bool decode(ArgumentDecoder*, WebCore::ResourceResponse&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceResponse&); - static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceResponse&); }; - template<> struct ArgumentCoder<WebCore::ResourceError> { -#if PLATFORM(MAC) - static const bool kShouldSerializeWebCoreData = false; -#else - static const bool kShouldSerializeWebCoreData = true; -#endif - static void encode(ArgumentEncoder*, const WebCore::ResourceError&); static bool decode(ArgumentDecoder*, WebCore::ResourceError&); - static void encodePlatformData(ArgumentEncoder*, const WebCore::ResourceError&); - static bool decodePlatformData(ArgumentDecoder*, WebCore::ResourceError&); }; template<> struct ArgumentCoder<WebCore::WindowFeatures> { @@ -282,24 +251,8 @@ template<> struct ArgumentCoder<WebCore::FilterOperations> { static bool decode(ArgumentDecoder*, WebCore::FilterOperations&); }; #endif - -#if USE(GRAPHICS_SURFACE) -template<> struct ArgumentCoder<WebCore::GraphicsSurfaceToken> { - static void encode(ArgumentEncoder*, const WebCore::GraphicsSurfaceToken&); - static bool decode(ArgumentDecoder*, WebCore::GraphicsSurfaceToken&); -}; -#endif #endif -template<> struct ArgumentCoder<WebCore::UserStyleSheet> { - static void encode(ArgumentEncoder*, const WebCore::UserStyleSheet&); - static bool decode(ArgumentDecoder*, WebCore::UserStyleSheet&); -}; - -template<> struct ArgumentCoder<WebCore::UserScript> { - static void encode(ArgumentEncoder*, const WebCore::UserScript&); - static bool decode(ArgumentDecoder*, WebCore::UserScript&); -}; } // namespace CoreIPC diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp index c9e36fa37..01fdfb890 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.cpp +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,20 +31,12 @@ namespace WebKit { -WebGeolocationPosition::WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) +WebGeolocationPosition::WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy) { m_data.timestamp = timestamp; m_data.latitude = latitude; m_data.longitude = longitude; m_data.accuracy = accuracy; - m_data.canProvideAltitude = providesAltitude; - m_data.altitude = altitude; - m_data.canProvideAltitudeAccuracy = providesAltitudeAccuracy; - m_data.altitudeAccuracy = altitudeAccuracy; - m_data.canProvideHeading = providesHeading; - m_data.heading = heading; - m_data.canProvideSpeed = providesSpeed; - m_data.speed = speed; } WebGeolocationPosition::~WebGeolocationPosition() @@ -53,15 +45,12 @@ WebGeolocationPosition::~WebGeolocationPosition() void WebGeolocationPosition::Data::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(timestamp, latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading)); - encoder->encode(CoreIPC::In(canProvideSpeed, speed)); + encoder->encode(CoreIPC::In(timestamp, latitude, longitude, accuracy)); } bool WebGeolocationPosition::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data) { - if (!decoder->decode(CoreIPC::Out(data.timestamp, data.latitude, data.longitude, data.accuracy, data.canProvideAltitude, data.altitude, data.canProvideAltitudeAccuracy, data.altitudeAccuracy, data.canProvideHeading, data.heading))) - return false; - return decoder->decode(CoreIPC::Out(data.canProvideSpeed, data.speed)); + return decoder->decode(CoreIPC::Out(data.timestamp, data.latitude, data.longitude, data.accuracy)); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.h b/Source/WebKit2/Shared/WebGeolocationPosition.h index a87bb062d..6b268fbbe 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.h +++ b/Source/WebKit2/Shared/WebGeolocationPosition.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,21 +45,11 @@ public: double latitude; double longitude; double accuracy; - - double altitude; - double altitudeAccuracy; - double heading; - double speed; - - bool canProvideAltitude; - bool canProvideAltitudeAccuracy; - bool canProvideHeading; - bool canProvideSpeed; }; - static PassRefPtr<WebGeolocationPosition> create(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) + static PassRefPtr<WebGeolocationPosition> create(double timestamp, double latitude, double longitude, double accuracy) { - return adoptRef(new WebGeolocationPosition(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed)); + return adoptRef(new WebGeolocationPosition(timestamp, latitude, longitude, accuracy)); } virtual ~WebGeolocationPosition(); @@ -69,22 +59,10 @@ public: double longitude() const { return m_data.longitude; } double accuracy() const { return m_data.accuracy; } - bool canProvideAltitude() const { return m_data.canProvideAltitude; } - double altitude() const { return m_data.altitude; } - - bool canProvideAltitudeAccuracy() const { return m_data.canProvideAltitudeAccuracy; } - double altitudeAccuracy() const { return m_data.altitudeAccuracy; } - - bool canProvideHeading() const { return m_data.canProvideHeading; } - double heading() const { return m_data.heading; } - - bool canProvideSpeed() const { return m_data.canProvideSpeed; } - double speed() const { return m_data.speed; } - const Data& data() const { return m_data; } private: - WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); + WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp index c227d8596..107df1d15 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.cpp +++ b/Source/WebKit2/Shared/WebPageGroupData.cpp @@ -26,35 +26,19 @@ #include "config.h" #include "WebPageGroupData.h" -#include "WebCoreArgumentCoders.h" +#include "ArgumentCoders.h" +#include "Arguments.h" namespace WebKit { void WebPageGroupData::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(identifer); - encoder->encode(pageGroupID); - encoder->encode(visibleToInjectedBundle); - encoder->encode(visibleToHistoryClient); - encoder->encode(userStyleSheets); - encoder->encode(userScripts); + return encoder->encode(CoreIPC::In(identifer, pageGroupID, visibleToInjectedBundle, visibleToHistoryClient)); } bool WebPageGroupData::decode(CoreIPC::ArgumentDecoder* decoder, WebPageGroupData& data) { - if (!decoder->decode(data.identifer)) - return false; - if (!decoder->decode(data.pageGroupID)) - return false; - if (!decoder->decode(data.visibleToInjectedBundle)) - return false; - if (!decoder->decode(data.visibleToHistoryClient)) - return false; - if (!decoder->decode(data.userStyleSheets)) - return false; - if (!decoder->decode(data.userScripts)) - return false; - return true; + return decoder->decode(CoreIPC::Out(data.identifer, data.pageGroupID, data.visibleToInjectedBundle, data.visibleToHistoryClient)); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPageGroupData.h b/Source/WebKit2/Shared/WebPageGroupData.h index b9aa0f8f5..36f6fe19b 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.h +++ b/Source/WebKit2/Shared/WebPageGroupData.h @@ -26,14 +26,11 @@ #ifndef WebPageGroupData_h #define WebPageGroupData_h -#include <WebCore/UserScript.h> -#include <WebCore/UserStyleSheet.h> -#include <wtf/Vector.h> #include <wtf/text/WTFString.h> namespace CoreIPC { -class ArgumentDecoder; -class ArgumentEncoder; + class ArgumentDecoder; + class ArgumentEncoder; } namespace WebKit { @@ -46,9 +43,6 @@ struct WebPageGroupData { uint64_t pageGroupID; bool visibleToInjectedBundle; bool visibleToHistoryClient; - - Vector<WebCore::UserStyleSheet> userStyleSheets; - Vector<WebCore::UserScript> userScripts; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp index 4f49bb786..746df10a4 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.cpp +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -151,7 +151,7 @@ static typename MapType::MappedType valueForKey(const MapType& map, const typena { typename MapType::const_iterator it = map.find(key); if (it != map.end()) - return it->value; + return it->second; return defaultValueForKey<typename MapType::MappedType>(key); } @@ -187,7 +187,7 @@ bool WebPreferencesStore::getBoolValueForKey(const String& key) const // FIXME: Extend overriding to other key types used from TestRunner. BoolOverridesMap::const_iterator it = boolTestRunnerOverridesMap().find(key); if (it != boolTestRunnerOverridesMap().end()) - return it->value; + return it->second; return valueForKey(m_boolValues, key); } diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index 185898334..dbaa4f203 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -135,9 +135,6 @@ namespace WebKit { macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, 0) \ macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED) \ macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED) \ - macro(CookieEnabled, cookieEnabled, Bool, bool, true) \ - macro(PlugInSnapshottingEnabled, plugInSnapshottingEnabled, Bool, bool, false) \ - macro(PDFPluginEnabled, pdfPluginEnabled, Bool, bool, false) \ \ #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp index 01234f76f..cc2cecc88 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -42,7 +42,6 @@ WebProcessCreationParameters::WebProcessCreationParameters() , nsURLCacheMemoryCapacity(0) , nsURLCacheDiskCapacity(0) , shouldForceScreenFontSubstitution(false) - , shouldEnableKerningAndLigaturesByDefault(false) #elif PLATFORM(WIN) , shouldPaintNativeControls(false) #endif @@ -66,11 +65,15 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con encoder->encode(urlSchemesRegisteredAsNoAccess); encoder->encode(urlSchemesRegisteredAsDisplayIsolated); encoder->encode(urlSchemesRegisteredAsCORSEnabled); + encoder->encode(mimeTypesWithCustomRepresentation); encoder->encodeEnum(cacheModel); encoder->encode(shouldTrackVisitedLinks); encoder->encode(shouldAlwaysUseComplexTextCodePath); encoder->encode(shouldUseFontSmoothing); encoder->encode(iconDatabaseEnabled); +#if ENABLE(PLUGIN_PROCESS) + encoder->encode(disablePluginProcessMessageTimeout); +#endif encoder->encode(terminationTimeout); encoder->encode(languages); encoder->encode(textCheckerState); @@ -90,7 +93,6 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con encoder->encode(uiProcessBundleResourcePath); encoder->encode(uiProcessBundleResourcePathExtensionHandle); encoder->encode(shouldForceScreenFontSubstitution); - encoder->encode(shouldEnableKerningAndLigaturesByDefault); #elif PLATFORM(WIN) encoder->encode(shouldPaintNativeControls); encoder->encode(cfURLCachePath); @@ -146,6 +148,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.urlSchemesRegisteredAsCORSEnabled)) return false; + if (!decoder->decode(parameters.mimeTypesWithCustomRepresentation)) + return false; if (!decoder->decodeEnum(parameters.cacheModel)) return false; if (!decoder->decode(parameters.shouldTrackVisitedLinks)) @@ -156,6 +160,10 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.iconDatabaseEnabled)) return false; +#if ENABLE(PLUGIN_PROCESS) + if (!decoder->decode(parameters.disablePluginProcessMessageTimeout)) + return false; +#endif if (!decoder->decode(parameters.terminationTimeout)) return false; if (!decoder->decode(parameters.languages)) @@ -192,8 +200,6 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.shouldForceScreenFontSubstitution)) return false; - if (!decoder->decode(parameters.shouldEnableKerningAndLigaturesByDefault)) - return false; #elif PLATFORM(WIN) if (!decoder->decode(parameters.shouldPaintNativeControls)) return false; diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h index f9548dfff..67ab33070 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.h +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -69,6 +69,9 @@ struct WebProcessCreationParameters { Vector<String> urlSchemesRegisteredAsDisplayIsolated; Vector<String> urlSchemesRegisteredAsCORSEnabled; + // MIME types for which the UI process will handle showing the data. + Vector<String> mimeTypesWithCustomRepresentation; + CacheModel cacheModel; bool shouldTrackVisitedLinks; @@ -77,6 +80,10 @@ struct WebProcessCreationParameters { bool iconDatabaseEnabled; +#if ENABLE(PLUGIN_PROCESS) + bool disablePluginProcessMessageTimeout; +#endif + double terminationTimeout; Vector<String> languages; @@ -109,8 +116,6 @@ struct WebProcessCreationParameters { SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle; bool shouldForceScreenFontSubstitution; - bool shouldEnableKerningAndLigaturesByDefault; - #elif PLATFORM(WIN) String cfURLCachePath; uint64_t cfURLCacheDiskCapacity; diff --git a/Source/WebKit2/Shared/WebRenderObject.cpp b/Source/WebKit2/Shared/WebRenderObject.cpp index 28f6391bb..146230e9d 100644 --- a/Source/WebKit2/Shared/WebRenderObject.cpp +++ b/Source/WebKit2/Shared/WebRenderObject.cpp @@ -75,7 +75,7 @@ WebRenderObject::WebRenderObject(RenderObject* renderer, bool shouldIncludeDesce } // FIXME: broken with transforms - m_absolutePosition = flooredIntPoint(renderer->localToAbsolute()); + m_absolutePosition = flooredIntPoint(renderer->localToAbsolute(FloatPoint())); if (renderer->isBox()) m_frameRect = toRenderBox(renderer)->pixelSnappedFrameRect(); diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.h b/Source/WebKit2/Shared/mac/PDFKitImports.h index c9a1e0a25..44c375c6b 100644 --- a/Source/WebKit2/Shared/mac/PDFKitImports.h +++ b/Source/WebKit2/Shared/mac/PDFKitImports.h @@ -33,10 +33,6 @@ Class classFromPDFKit(NSString *className); Class pdfAnnotationLinkClass(); Class pdfDocumentClass(); -#if ENABLE(PDFKIT_PLUGIN) -Class pdfLayerControllerClass(); -#endif - } #endif // PDFKitImports_h diff --git a/Source/WebKit2/Shared/mac/PDFKitImports.mm b/Source/WebKit2/Shared/mac/PDFKitImports.mm index bccfbefda..6234a8395 100644 --- a/Source/WebKit2/Shared/mac/PDFKitImports.mm +++ b/Source/WebKit2/Shared/mac/PDFKitImports.mm @@ -54,14 +54,5 @@ Class pdfDocumentClass() ASSERT(pdfDocumentClass); return pdfDocumentClass; } - -#if ENABLE(PDFKIT_PLUGIN) -Class pdfLayerControllerClass() -{ - static Class pdfLayerControllerClass = classFromPDFKit(@"PDFLayerController"); - ASSERT(pdfLayerControllerClass); - return pdfLayerControllerClass; -} -#endif } diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm index 9f04ef95e..196ab11c7 100644 --- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm +++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm @@ -38,7 +38,7 @@ using namespace WebKit; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) { bool requestIsPresent = resourceRequest.nsURLRequest(); encoder->encode(requestIsPresent); @@ -50,7 +50,7 @@ void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder CoreIPC::encode(encoder, dictionary.get()); } -bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) { bool requestIsPresent; if (!decoder->decode(requestIsPresent)) @@ -73,7 +73,7 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder return true; } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) { bool responseIsPresent = resourceResponse.nsURLResponse(); encoder->encode(responseIsPresent); @@ -85,7 +85,7 @@ void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encode CoreIPC::encode(encoder, dictionary.get()); } -bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) { bool responseIsPresent; if (!decoder->decode(responseIsPresent)) @@ -113,7 +113,7 @@ static NSString* nsString(const String& string) return string.impl() ? [NSString stringWithCharacters:reinterpret_cast<const UniChar*>(string.characters()) length:string.length()] : @""; } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { bool errorIsNull = resourceError.isNull(); encoder->encode(errorIsNull); @@ -147,7 +147,7 @@ void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, encoder->encode(PlatformCertificateInfo((CFArrayRef)peerCertificateChain)); } -bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError) +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) { bool errorIsNull; if (!decoder->decode(errorIsNull)) @@ -183,7 +183,7 @@ bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, HashMap<String, String>::const_iterator it = stringUserInfoMap.begin(); HashMap<String, String>::const_iterator end = stringUserInfoMap.end(); for (; it != end; ++it) - [userInfo setObject:nsString(it->value) forKey:nsString(it->key)]; + [userInfo setObject:nsString(it->second) forKey:nsString(it->first)]; if (certificate.certificateChain()) [userInfo setObject:(NSArray *)certificate.certificateChain() forKey:@"NSErrorPeerCertificateChainKey"]; diff --git a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp index a439caff1..c89bf44f1 100644 --- a/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/ArgumentCodersQt.cpp @@ -86,8 +86,8 @@ bool ArgumentCoder<WebCore::DragData>::decode(ArgumentDecoder* decoder, DragData MIMEDataHashMap::iterator it = map.begin(); MIMEDataHashMap::iterator end = map.end(); for (; it != end; ++it) { - QByteArray bytes((char*)it->value.data(), it->value.size()); - mimeData->setData(it->key, bytes); + QByteArray bytes((char*)it->second.data(), it->second.size()); + mimeData->setData(it->first, bytes); } } diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp index 874e1c381..88e4d3aec 100644 --- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -53,8 +53,8 @@ void ShareableBitmap::releaseSharedMemoryData(void* typelessBitmap) PassRefPtr<Image> ShareableBitmap::createImage() { - QPixmap* pixmap = new QPixmap(QPixmap::fromImage(createQImage())); - return BitmapImage::create(pixmap); + QImage* image = new QImage(createQImage()); + return BitmapImage::create(image); } PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() @@ -82,13 +82,8 @@ void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const I return; } - QImage image = createQImage(); - QPainter* painter = context.platformContext(); - - painter->save(); - painter->scale(scaleFactor, scaleFactor); - painter->drawImage(dstPoint, image, QRect(srcRect)); - painter->restore(); + // See <https://bugs.webkit.org/show_bug.cgi?id=64663>. + notImplemented(); } } diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp index f8d643b98..ad5574f8f 100644 --- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -34,32 +34,100 @@ using namespace WebCore; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) { + encoder->encode(resourceRequest.url().string()); } -bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) { + // FIXME: Add *more* coding implementation when we want to implement something that + // depends on this like the policy client. + + String url; + if (!decoder->decode(url)) + return false; + resourceRequest.setURL(KURL(KURL(), url)); return true; } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) { + encoder->encode(resourceResponse.url().string()); + encoder->encode(resourceResponse.mimeType()); + encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength())); + encoder->encode(resourceResponse.textEncodingName()); + encoder->encode(resourceResponse.suggestedFilename()); } -bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) { + ResourceResponse response; + + String url; + if (!decoder->decode(url)) + return false; + response.setURL(KURL(WebCore::ParsedURLString, url)); + + String mimeType; + if (!decoder->decode(mimeType)) + return false; + response.setMimeType(mimeType); + + int64_t contentLength; + if (!decoder->decode(contentLength)) + return false; + response.setExpectedContentLength(contentLength); + + String textEncodingName; + if (!decoder->decode(textEncodingName)) + return false; + response.setTextEncodingName(textEncodingName); + + String suggestedFilename; + if (!decoder->decode(suggestedFilename)) + return false; + response.setSuggestedFilename(suggestedFilename); + + resourceResponse = response; return true; } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { + encoder->encode(resourceError.domain()); + encoder->encode(resourceError.errorCode()); + encoder->encode(resourceError.failingURL()); + encoder->encode(resourceError.localizedDescription()); + encoder->encode(resourceError.isCancellation()); } -bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError) +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) { + String domain; + if (!decoder->decode(domain)) + return false; + + int errorCode; + if (!decoder->decode(errorCode)) + return false; + + String failingURL; + if (!decoder->decode(failingURL)) + return false; + + String localizedDescription; + if (!decoder->decode(localizedDescription)) + return false; + + bool isCancellation; + if (!decoder->decode(isCancellation)) + return false; + + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); + resourceError.setIsCancellation(isCancellation); return true; } diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.h b/Source/WebKit2/Shared/qt/WebEventFactoryQt.h index e5e3a101b..f1c24fb00 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.h +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.h @@ -38,7 +38,6 @@ class QTouchEvent; class QMouseEvent; class QWheelEvent; class QKeyEvent; -class QTransform; QT_END_NAMESPACE diff --git a/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp b/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp index c47d7eba1..dbe2c51cd 100644 --- a/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp +++ b/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp @@ -36,42 +36,191 @@ using namespace WebCore; namespace CoreIPC { -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) { + encoder->encode(resourceRequest.url().string()); + encoder->encode(resourceRequest.httpMethod()); + + const HTTPHeaderMap& headers = resourceRequest.httpHeaderFields(); + encoder->encode(headers); + + FormData* httpBody = resourceRequest.httpBody(); + encoder->encode(static_cast<bool>(httpBody)); + if (httpBody) + encoder->encode(httpBody->flattenToString()); + + encoder->encode(resourceRequest.firstPartyForCookies().string()); encoder->encode(static_cast<uint32_t>(resourceRequest.soupMessageFlags())); } -bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) { + ResourceRequest request; + + String url; + if (!decoder->decode(url)) + return false; + request.setURL(KURL(KURL(), url)); + + String httpMethod; + if (!decoder->decode(httpMethod)) + return false; + request.setHTTPMethod(httpMethod); + + HTTPHeaderMap headers; + if (!decoder->decode(headers)) + return false; + request.addHTTPHeaderFields(headers); + + bool hasHTTPBody; + if (!decoder->decode(hasHTTPBody)) + return false; + if (hasHTTPBody) { + String httpBody; + if (!decoder->decode(httpBody)) + return false; + request.setHTTPBody(FormData::create(httpBody.utf8())); + } + + String firstPartyForCookies; + if (!decoder->decode(firstPartyForCookies)) + return false; + request.setFirstPartyForCookies(KURL(KURL(), firstPartyForCookies)); + uint32_t soupMessageFlags; if (!decoder->decode(soupMessageFlags)) return false; - resourceRequest.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags)); + request.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags)); + + resourceRequest = request; return true; } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) { + bool responseIsNull = resourceResponse.isNull(); + encoder->encode(responseIsNull); + if (responseIsNull) + return; + + encoder->encode(resourceResponse.url().string()); + encoder->encode(static_cast<int32_t>(resourceResponse.httpStatusCode())); + + const HTTPHeaderMap& headers = resourceResponse.httpHeaderFields(); + encoder->encode(headers); + encoder->encode(static_cast<uint32_t>(resourceResponse.soupMessageFlags())); + encoder->encode(resourceResponse.mimeType()); + encoder->encode(resourceResponse.textEncodingName()); + encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength())); + encoder->encode(resourceResponse.httpStatusText()); + encoder->encode(resourceResponse.suggestedFilename()); } -bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) { + bool responseIsNull; + if (!decoder->decode(responseIsNull)) + return false; + if (responseIsNull) { + resourceResponse = ResourceResponse(); + return true; + } + + ResourceResponse response; + + String url; + if (!decoder->decode(url)) + return false; + response.setURL(KURL(KURL(), url)); + + int32_t httpStatusCode; + if (!decoder->decode(httpStatusCode)) + return false; + response.setHTTPStatusCode(httpStatusCode); + + HTTPHeaderMap headers; + if (!decoder->decode(headers)) + return false; + for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) + response.setHTTPHeaderField(it->first, it->second); + uint32_t soupMessageFlags; if (!decoder->decode(soupMessageFlags)) return false; - resourceResponse.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags)); + response.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags)); + + String mimeType; + if (!decoder->decode(mimeType)) + return false; + response.setMimeType(mimeType); + + String textEncodingName; + if (!decoder->decode(textEncodingName)) + return false; + response.setTextEncodingName(textEncodingName); + + int64_t contentLength; + if (!decoder->decode(contentLength)) + return false; + response.setExpectedContentLength(contentLength); + + String httpStatusText; + if (!decoder->decode(httpStatusText)) + return false; + response.setHTTPStatusText(httpStatusText); + + String suggestedFilename; + if (!decoder->decode(suggestedFilename)) + return false; + response.setSuggestedFilename(suggestedFilename); + + resourceResponse = response; return true; } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { + bool errorIsNull = resourceError.isNull(); + encoder->encode(errorIsNull); + if (errorIsNull) + return; + + encoder->encode(resourceError.domain()); + encoder->encode(resourceError.errorCode()); + encoder->encode(resourceError.failingURL()); + encoder->encode(resourceError.localizedDescription()); } -bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError) +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) { + bool errorIsNull; + if (!decoder->decode(errorIsNull)) + return false; + if (errorIsNull) { + resourceError = ResourceError(); + return true; + } + + String domain; + if (!decoder->decode(domain)) + return false; + + int errorCode; + if (!decoder->decode(errorCode)) + return false; + + String failingURL; + if (!decoder->decode(failingURL)) + return false; + + String localizedDescription; + if (!decoder->decode(localizedDescription)) + return false; + + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); return true; } diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp index a61409194..0762275b0 100644 --- a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp +++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp @@ -49,7 +49,7 @@ namespace CoreIPC { // FIXME: These coders should really go in a WebCoreArgumentCodersCFNetwork file. -void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) { #if USE(CFNETWORK) bool requestIsPresent = resourceRequest.cfURLRequest(); @@ -63,7 +63,7 @@ void ArgumentCoder<ResourceRequest>::encodePlatformData(ArgumentEncoder* encoder #endif } -bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) { #if USE(CFNETWORK) bool requestIsPresent; @@ -95,7 +95,7 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(ArgumentDecoder* decoder } -void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) { #if USE(CFNETWORK) bool responseIsPresent = resourceResponse.cfURLResponse(); @@ -109,7 +109,7 @@ void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder* encode #endif } -bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) { #if USE(CFNETWORK) bool responseIsPresent; @@ -137,25 +137,50 @@ bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder* decode } -void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder* encoder, const ResourceError& resourceError) +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { + encoder->encode(resourceError.domain()); + encoder->encode(resourceError.errorCode()); + encoder->encode(resourceError.failingURL()); + encoder->encode(resourceError.localizedDescription()); + #if USE(CFNETWORK) encoder->encode(PlatformCertificateInfo(resourceError.certificate())); #endif } -bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder* decoder, ResourceError& resourceError) +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) { + String domain; + if (!decoder->decode(domain)) + return false; + + int errorCode; + if (!decoder->decode(errorCode)) + return false; + + String failingURL; + if (!decoder->decode(failingURL)) + return false; + + String localizedDescription; + if (!decoder->decode(localizedDescription)) + return false; + #if USE(CFNETWORK) PlatformCertificateInfo certificate; if (!decoder->decode(certificate)) return false; const Vector<PCCERT_CONTEXT> certificateChain = certificate.certificateChain(); - if (!certificateChain.isEmpty()) - resourceError.setCertificate(copyCertificateToData(certificateChain.first()).get()); + if (!certificateChain.isEmpty()) { + ASSERT(certificateChain.size() == 1); + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription, copyCertificateToData(certificateChain.first()).get()); + return true; + } #endif + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); return true; } |