https://bugs.webkit.org/show_bug.cgi?id=77349
Source/WebCore:
Patch by raman Tenneti <rtenneti@chromium.org> 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 <rtenneti@chromium.org> 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
+2012-02-18 raman Tenneti <rtenneti@chromium.org>
+
+ 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 <inferno@chromium.org>
Unreviewed, rolling out r107965.
class ResourceResponse : public ResourceResponseBase {
public:
+ class ExtraData : public RefCounted<ExtraData> {
+ public:
+ virtual ~ExtraData() { }
+ };
+
ResourceResponse()
: m_appCacheID(0)
, m_isMultipartPayload(false)
const File* downloadedFile() const { return m_downloadedFile.get(); }
void setDownloadedFile(PassRefPtr<File> downloadedFile) { m_downloadedFile = downloadedFile; }
+ // Extra data associated with this response.
+ ExtraData* extraData() const { return m_extraData.get(); }
+ void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
+
private:
friend class ResourceResponseBase;
// The downloaded file if the load streamed to a file.
RefPtr<File> m_downloadedFile;
+
+ // ExtraData associated with the response.
+ RefPtr<ExtraData> m_extraData;
};
struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
+2012-02-18 raman Tenneti <rtenneti@chromium.org>
+
+ 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 <jsbell@chromium.org>
IndexedDB: Support overloaded methods that take IDBKey or IDBKeyRange
'tests/WebPageSerializerTest.cpp',
'tests/WebSocketExtensionDispatcherTest.cpp',
'tests/WebURLRequestTest.cpp',
+ 'tests/WebURLResponseTest.cpp',
'tests/WebViewTest.cpp',
],
class WebURLResponse {
public:
+ class ExtraData {
+ public:
+ virtual ~ExtraData() { }
+ };
+
~WebURLResponse() { reset(); }
WebURLResponse() : m_private(0) { }
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*);
namespace WebKit {
+namespace {
+
+class ExtraDataContainer : public ResourceResponse::ExtraData {
+public:
+ static PassRefPtr<ExtraDataContainer> 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<WebURLResponse::ExtraData> m_extraData;
+};
+
+} // namespace
+
// The standard implementation of WebURLResponsePrivate, which maintains
// ownership of a ResourceResponse instance.
class WebURLResponsePrivateImpl : public WebURLResponsePrivate {
m_private->m_resourceResponse->setRemotePort(remotePort);
}
+WebURLResponse::ExtraData* WebURLResponse::extraData() const
+{
+ RefPtr<ResourceResponse::ExtraData> data = m_private->m_resourceResponse->extraData();
+ if (!data)
+ return 0;
+ return static_cast<ExtraDataContainer*>(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
--- /dev/null
+/*
+ * 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 <gtest/gtest.h>
+
+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