From: commit-queue@webkit.org Date: Sun, 19 Feb 2012 06:25:41 +0000 (+0000) Subject: Track the NPN protocol version negotiated with the server X-Git-Tag: 070512121124~12445 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3cb5bf916676d2c751caa9a77fb8690d802fe0a;p=profile%2Fivi%2Fwebkit-efl.git Track the NPN protocol version negotiated with the server https://bugs.webkit.org/show_bug.cgi?id=77349 Source/WebCore: Patch by raman Tenneti on 2012-02-18 Reviewed by Darin Fisher.. [chromium] Added ExtraData to WebURLResponse. No intended functionality change. * platform/network/chromium/ResourceResponse.h: (ExtraData): (WebCore::ResourceResponse::ExtraData::~ExtraData): (ResourceResponse): (WebCore::ResourceResponse::extraData): (WebCore::ResourceResponse::setExtraData): Source/WebKit/chromium: Patch by raman Tenneti on 2012-02-18 Reviewed by Darin Fisher. [chromium] Added ExtraData to WebURLResponse. * WebKit.gypi: * public/platform/WebURLResponse.h: (ExtraData): (WebKit::WebURLResponse::ExtraData::~ExtraData): (WebURLResponse): * src/WebURLResponse.cpp: (WebKit::WebURLResponse::extraData): (WebKit): (WebKit::WebURLResponse::setExtraData): * tests/WebURLResponseTest.cpp: Added. (WebKit): (TestExtraData): (WebKit::TestExtraData::TestExtraData): (WebKit::TestExtraData::~TestExtraData): (WebKit::TEST): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108184 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 4e4cced..f497a88 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2012-02-18 raman Tenneti + + Track the NPN protocol version negotiated with the server + https://bugs.webkit.org/show_bug.cgi?id=77349 + + Reviewed by Darin Fisher.. + + [chromium] Added ExtraData to WebURLResponse. + + No intended functionality change. + + * platform/network/chromium/ResourceResponse.h: + (ExtraData): + (WebCore::ResourceResponse::ExtraData::~ExtraData): + (ResourceResponse): + (WebCore::ResourceResponse::extraData): + (WebCore::ResourceResponse::setExtraData): + 2012-02-18 Abhishek Arya Unreviewed, rolling out r107965. diff --git a/Source/WebCore/platform/network/chromium/ResourceResponse.h b/Source/WebCore/platform/network/chromium/ResourceResponse.h index a2a8c5d..997cd71 100644 --- a/Source/WebCore/platform/network/chromium/ResourceResponse.h +++ b/Source/WebCore/platform/network/chromium/ResourceResponse.h @@ -36,6 +36,11 @@ namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: + class ExtraData : public RefCounted { + public: + virtual ~ExtraData() { } + }; + ResourceResponse() : m_appCacheID(0) , m_isMultipartPayload(false) @@ -103,6 +108,10 @@ namespace WebCore { const File* downloadedFile() const { return m_downloadedFile.get(); } void setDownloadedFile(PassRefPtr downloadedFile) { m_downloadedFile = downloadedFile; } + // Extra data associated with this response. + ExtraData* extraData() const { return m_extraData.get(); } + void setExtraData(PassRefPtr extraData) { m_extraData = extraData; } + private: friend class ResourceResponseBase; @@ -155,6 +164,9 @@ namespace WebCore { // The downloaded file if the load streamed to a file. RefPtr m_downloadedFile; + + // ExtraData associated with the response. + RefPtr m_extraData; }; struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase { diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index dc132f3..cccbfce 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,28 @@ +2012-02-18 raman Tenneti + + Track the NPN protocol version negotiated with the server + https://bugs.webkit.org/show_bug.cgi?id=77349 + + Reviewed by Darin Fisher. + + [chromium] Added ExtraData to WebURLResponse. + + * WebKit.gypi: + * public/platform/WebURLResponse.h: + (ExtraData): + (WebKit::WebURLResponse::ExtraData::~ExtraData): + (WebURLResponse): + * src/WebURLResponse.cpp: + (WebKit::WebURLResponse::extraData): + (WebKit): + (WebKit::WebURLResponse::setExtraData): + * tests/WebURLResponseTest.cpp: Added. + (WebKit): + (TestExtraData): + (WebKit::TestExtraData::TestExtraData): + (WebKit::TestExtraData::~TestExtraData): + (WebKit::TEST): + 2012-02-17 Joshua Bell IndexedDB: Support overloaded methods that take IDBKey or IDBKeyRange diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 35f2b19..fcd09c4 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -120,6 +120,7 @@ 'tests/WebPageSerializerTest.cpp', 'tests/WebSocketExtensionDispatcherTest.cpp', 'tests/WebURLRequestTest.cpp', + 'tests/WebURLResponseTest.cpp', 'tests/WebViewTest.cpp', ], diff --git a/Source/WebKit/chromium/public/platform/WebURLResponse.h b/Source/WebKit/chromium/public/platform/WebURLResponse.h index 8629b84..8d53eac 100644 --- a/Source/WebKit/chromium/public/platform/WebURLResponse.h +++ b/Source/WebKit/chromium/public/platform/WebURLResponse.h @@ -50,6 +50,11 @@ class WebURLResponsePrivate; class WebURLResponse { public: + class ExtraData { + public: + virtual ~ExtraData() { } + }; + ~WebURLResponse() { reset(); } WebURLResponse() : m_private(0) { } @@ -174,6 +179,15 @@ public: WEBKIT_EXPORT unsigned short remotePort() const; WEBKIT_EXPORT void setRemotePort(unsigned short); + // Extra data associated with the underlying resource response. Resource + // responses can be copied. If non-null, each copy of a resource response + // holds a pointer to the extra data, and the extra data pointer will be + // deleted when the last resource response is destroyed. Setting the extra + // data pointer will cause the underlying resource response to be + // dissociated from any existing non-null extra data pointer. + WEBKIT_EXPORT ExtraData* extraData() const; + WEBKIT_EXPORT void setExtraData(ExtraData*); + protected: void assign(WebURLResponsePrivate*); diff --git a/Source/WebKit/chromium/src/WebURLResponse.cpp b/Source/WebKit/chromium/src/WebURLResponse.cpp index 2eacda5..ec212e5 100644 --- a/Source/WebKit/chromium/src/WebURLResponse.cpp +++ b/Source/WebKit/chromium/src/WebURLResponse.cpp @@ -47,6 +47,27 @@ using namespace WebCore; namespace WebKit { +namespace { + +class ExtraDataContainer : public ResourceResponse::ExtraData { +public: + static PassRefPtr create(WebURLResponse::ExtraData* extraData) { return adoptRef(new ExtraDataContainer(extraData)); } + + virtual ~ExtraDataContainer() { } + + WebURLResponse::ExtraData* extraData() const { return m_extraData.get(); } + +private: + explicit ExtraDataContainer(WebURLResponse::ExtraData* extraData) + : m_extraData(adoptPtr(extraData)) + { + } + + OwnPtr m_extraData; +}; + +} // namespace + // The standard implementation of WebURLResponsePrivate, which maintains // ownership of a ResourceResponse instance. class WebURLResponsePrivateImpl : public WebURLResponsePrivate { @@ -399,6 +420,19 @@ void WebURLResponse::setRemotePort(unsigned short remotePort) m_private->m_resourceResponse->setRemotePort(remotePort); } +WebURLResponse::ExtraData* WebURLResponse::extraData() const +{ + RefPtr data = m_private->m_resourceResponse->extraData(); + if (!data) + return 0; + return static_cast(data.get())->extraData(); +} + +void WebURLResponse::setExtraData(WebURLResponse::ExtraData* extraData) +{ + m_private->m_resourceResponse->setExtraData(ExtraDataContainer::create(extraData)); +} + void WebURLResponse::assign(WebURLResponsePrivate* p) { // Subclasses may call this directly so a self-assignment check is needed diff --git a/Source/WebKit/chromium/tests/WebURLResponseTest.cpp b/Source/WebKit/chromium/tests/WebURLResponseTest.cpp new file mode 100644 index 0000000..112ed86 --- /dev/null +++ b/Source/WebKit/chromium/tests/WebURLResponseTest.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2012 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 "platform/WebURLResponse.h" + +#include + +using namespace WebKit; + +namespace { + +class TestExtraData : public WebURLResponse::ExtraData { +public: + explicit TestExtraData(bool* alive) + : m_alive(alive) + { + *alive = true; + } + + virtual ~TestExtraData() { *m_alive = false; } + +private: + bool* m_alive; +}; + +TEST(WebURLResponseTest, ExtraData) +{ + bool alive = false; + { + WebURLResponse urlResponse; + TestExtraData* extraData = new TestExtraData(&alive); + EXPECT_TRUE(alive); + + urlResponse.initialize(); + urlResponse.setExtraData(extraData); + EXPECT_EQ(extraData, urlResponse.extraData()); + { + WebURLResponse otherUrlResponse = urlResponse; + EXPECT_TRUE(alive); + EXPECT_EQ(extraData, otherUrlResponse.extraData()); + EXPECT_EQ(extraData, urlResponse.extraData()); + } + EXPECT_TRUE(alive); + EXPECT_EQ(extraData, urlResponse.extraData()); + } + EXPECT_FALSE(alive); +} + +} // namespace