OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 , m_appCacheID(0) | 95 , m_appCacheID(0) |
96 , m_wasFetchedViaSPDY(false) | 96 , m_wasFetchedViaSPDY(false) |
97 , m_wasNpnNegotiated(false) | 97 , m_wasNpnNegotiated(false) |
98 , m_wasAlternateProtocolAvailable(false) | 98 , m_wasAlternateProtocolAvailable(false) |
99 , m_wasFetchedViaProxy(false) | 99 , m_wasFetchedViaProxy(false) |
100 , m_wasFetchedViaServiceWorker(false) | 100 , m_wasFetchedViaServiceWorker(false) |
101 , m_wasFallbackRequiredByServiceWorker(false) | 101 , m_wasFallbackRequiredByServiceWorker(false) |
102 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) | 102 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) |
103 , m_responseTime(0) | 103 , m_responseTime(0) |
104 , m_remotePort(0) | 104 , m_remotePort(0) |
| 105 , m_encodedBodyLength(0) |
| 106 , m_decodedBodyLength(0) |
105 { | 107 { |
106 } | 108 } |
107 | 109 |
108 ResourceResponse::ResourceResponse(const KURL& url, const AtomicString& mimeType
, long long expectedLength, const AtomicString& textEncodingName, const String&
filename) | 110 ResourceResponse::ResourceResponse(const KURL& url, const AtomicString& mimeType
, long long expectedLength, const AtomicString& textEncodingName, const String&
filename) |
109 : m_url(url) | 111 : m_url(url) |
110 , m_mimeType(mimeType) | 112 , m_mimeType(mimeType) |
111 , m_expectedContentLength(expectedLength) | 113 , m_expectedContentLength(expectedLength) |
112 , m_textEncodingName(textEncodingName) | 114 , m_textEncodingName(textEncodingName) |
113 , m_suggestedFilename(filename) | 115 , m_suggestedFilename(filename) |
114 , m_httpStatusCode(0) | 116 , m_httpStatusCode(0) |
(...skipping 16 matching lines...) Expand all Loading... |
131 , m_appCacheID(0) | 133 , m_appCacheID(0) |
132 , m_wasFetchedViaSPDY(false) | 134 , m_wasFetchedViaSPDY(false) |
133 , m_wasNpnNegotiated(false) | 135 , m_wasNpnNegotiated(false) |
134 , m_wasAlternateProtocolAvailable(false) | 136 , m_wasAlternateProtocolAvailable(false) |
135 , m_wasFetchedViaProxy(false) | 137 , m_wasFetchedViaProxy(false) |
136 , m_wasFetchedViaServiceWorker(false) | 138 , m_wasFetchedViaServiceWorker(false) |
137 , m_wasFallbackRequiredByServiceWorker(false) | 139 , m_wasFallbackRequiredByServiceWorker(false) |
138 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) | 140 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) |
139 , m_responseTime(0) | 141 , m_responseTime(0) |
140 , m_remotePort(0) | 142 , m_remotePort(0) |
| 143 , m_encodedBodyLength(0) |
| 144 , m_decodedBodyLength(0) |
141 { | 145 { |
142 } | 146 } |
143 | 147 |
144 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) | 148 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) |
145 : ResourceResponse() | 149 : ResourceResponse() |
146 { | 150 { |
147 setURL(data->m_url); | 151 setURL(data->m_url); |
148 setMimeType(AtomicString(data->m_mimeType)); | 152 setMimeType(AtomicString(data->m_mimeType)); |
149 setExpectedContentLength(data->m_expectedContentLength); | 153 setExpectedContentLength(data->m_expectedContentLength); |
150 setTextEncodingName(AtomicString(data->m_textEncodingName)); | 154 setTextEncodingName(AtomicString(data->m_textEncodingName)); |
(...skipping 26 matching lines...) Expand all Loading... |
177 m_wasAlternateProtocolAvailable = data->m_wasAlternateProtocolAvailable; | 181 m_wasAlternateProtocolAvailable = data->m_wasAlternateProtocolAvailable; |
178 m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; | 182 m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; |
179 m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; | 183 m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; |
180 m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceW
orker; | 184 m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceW
orker; |
181 m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; | 185 m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; |
182 m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; | 186 m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; |
183 m_cacheStorageCacheName = data->m_cacheStorageCacheName; | 187 m_cacheStorageCacheName = data->m_cacheStorageCacheName; |
184 m_responseTime = data->m_responseTime; | 188 m_responseTime = data->m_responseTime; |
185 m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); | 189 m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); |
186 m_remotePort = data->m_remotePort; | 190 m_remotePort = data->m_remotePort; |
| 191 m_encodedBodyLength = data->m_encodedBodyLength; |
| 192 m_decodedBodyLength = data->m_decodedBodyLength; |
187 m_downloadedFilePath = data->m_downloadedFilePath; | 193 m_downloadedFilePath = data->m_downloadedFilePath; |
188 m_downloadedFileHandle = data->m_downloadedFileHandle; | 194 m_downloadedFileHandle = data->m_downloadedFileHandle; |
189 | 195 |
190 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 196 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
191 // whatever values may be present in the opaque m_extraData structure. | 197 // whatever values may be present in the opaque m_extraData structure. |
192 } | 198 } |
193 | 199 |
194 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; | 200 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; |
195 ResourceResponse& ResourceResponse::operator=(const ResourceResponse&) = default
; | 201 ResourceResponse& ResourceResponse::operator=(const ResourceResponse&) = default
; |
196 | 202 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 data->m_wasAlternateProtocolAvailable = m_wasAlternateProtocolAvailable; | 235 data->m_wasAlternateProtocolAvailable = m_wasAlternateProtocolAvailable; |
230 data->m_wasFetchedViaProxy = m_wasFetchedViaProxy; | 236 data->m_wasFetchedViaProxy = m_wasFetchedViaProxy; |
231 data->m_wasFetchedViaServiceWorker = m_wasFetchedViaServiceWorker; | 237 data->m_wasFetchedViaServiceWorker = m_wasFetchedViaServiceWorker; |
232 data->m_wasFallbackRequiredByServiceWorker = m_wasFallbackRequiredByServiceW
orker; | 238 data->m_wasFallbackRequiredByServiceWorker = m_wasFallbackRequiredByServiceW
orker; |
233 data->m_serviceWorkerResponseType = m_serviceWorkerResponseType; | 239 data->m_serviceWorkerResponseType = m_serviceWorkerResponseType; |
234 data->m_originalURLViaServiceWorker = m_originalURLViaServiceWorker.copy(); | 240 data->m_originalURLViaServiceWorker = m_originalURLViaServiceWorker.copy(); |
235 data->m_cacheStorageCacheName = cacheStorageCacheName().isolatedCopy(); | 241 data->m_cacheStorageCacheName = cacheStorageCacheName().isolatedCopy(); |
236 data->m_responseTime = m_responseTime; | 242 data->m_responseTime = m_responseTime; |
237 data->m_remoteIPAddress = m_remoteIPAddress.getString().isolatedCopy(); | 243 data->m_remoteIPAddress = m_remoteIPAddress.getString().isolatedCopy(); |
238 data->m_remotePort = m_remotePort; | 244 data->m_remotePort = m_remotePort; |
| 245 data->m_encodedBodyLength = m_encodedBodyLength; |
| 246 data->m_decodedBodyLength = m_decodedBodyLength; |
239 data->m_downloadedFilePath = m_downloadedFilePath.isolatedCopy(); | 247 data->m_downloadedFilePath = m_downloadedFilePath.isolatedCopy(); |
240 data->m_downloadedFileHandle = m_downloadedFileHandle; | 248 data->m_downloadedFileHandle = m_downloadedFileHandle; |
241 | 249 |
242 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 250 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
243 // whatever values may be present in the opaque m_extraData structure. | 251 // whatever values may be present in the opaque m_extraData structure. |
244 | 252 |
245 return data; | 253 return data; |
246 } | 254 } |
247 | 255 |
248 bool ResourceResponse::isHTTP() const | 256 bool ResourceResponse::isHTTP() const |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 PassRefPtr<ResourceLoadInfo> ResourceResponse::resourceLoadInfo() const | 584 PassRefPtr<ResourceLoadInfo> ResourceResponse::resourceLoadInfo() const |
577 { | 585 { |
578 return m_resourceLoadInfo.get(); | 586 return m_resourceLoadInfo.get(); |
579 } | 587 } |
580 | 588 |
581 void ResourceResponse::setResourceLoadInfo(PassRefPtr<ResourceLoadInfo> loadInfo
) | 589 void ResourceResponse::setResourceLoadInfo(PassRefPtr<ResourceLoadInfo> loadInfo
) |
582 { | 590 { |
583 m_resourceLoadInfo = loadInfo; | 591 m_resourceLoadInfo = loadInfo; |
584 } | 592 } |
585 | 593 |
| 594 void ResourceResponse::addToEncodedBodyLength(int value) |
| 595 { |
| 596 m_encodedBodyLength += value; |
| 597 } |
| 598 |
| 599 void ResourceResponse::addToDecodedBodyLength(int value) |
| 600 { |
| 601 m_decodedBodyLength += value; |
| 602 } |
| 603 |
586 void ResourceResponse::setDownloadedFilePath(const String& downloadedFilePath) | 604 void ResourceResponse::setDownloadedFilePath(const String& downloadedFilePath) |
587 { | 605 { |
588 m_downloadedFilePath = downloadedFilePath; | 606 m_downloadedFilePath = downloadedFilePath; |
589 if (m_downloadedFilePath.isEmpty()) { | 607 if (m_downloadedFilePath.isEmpty()) { |
590 m_downloadedFileHandle.clear(); | 608 m_downloadedFileHandle.clear(); |
591 return; | 609 return; |
592 } | 610 } |
593 std::unique_ptr<BlobData> blobData = BlobData::create(); | 611 std::unique_ptr<BlobData> blobData = BlobData::create(); |
594 blobData->appendFile(m_downloadedFilePath); | 612 blobData->appendFile(m_downloadedFilePath); |
595 blobData->detachFromCurrentThread(); | 613 blobData->detachFromCurrentThread(); |
(...skipping 17 matching lines...) Expand all Loading... |
613 if (a.httpStatusCode() != b.httpStatusCode()) | 631 if (a.httpStatusCode() != b.httpStatusCode()) |
614 return false; | 632 return false; |
615 if (a.httpStatusText() != b.httpStatusText()) | 633 if (a.httpStatusText() != b.httpStatusText()) |
616 return false; | 634 return false; |
617 if (a.httpHeaderFields() != b.httpHeaderFields()) | 635 if (a.httpHeaderFields() != b.httpHeaderFields()) |
618 return false; | 636 return false; |
619 if (a.resourceLoadTiming() && b.resourceLoadTiming() && *a.resourceLoadTimin
g() == *b.resourceLoadTiming()) | 637 if (a.resourceLoadTiming() && b.resourceLoadTiming() && *a.resourceLoadTimin
g() == *b.resourceLoadTiming()) |
620 return true; | 638 return true; |
621 if (a.resourceLoadTiming() != b.resourceLoadTiming()) | 639 if (a.resourceLoadTiming() != b.resourceLoadTiming()) |
622 return false; | 640 return false; |
| 641 if (a.encodedBodyLength() != b.encodedBodyLength()) |
| 642 return false; |
| 643 if (a.decodedBodyLength() != b.decodedBodyLength()) |
| 644 return false; |
623 return true; | 645 return true; |
624 } | 646 } |
625 | 647 |
626 } // namespace blink | 648 } // namespace blink |
OLD | NEW |