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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_wasFetchedViaForeignFetch(false) | 101 , m_wasFetchedViaForeignFetch(false) |
102 , m_wasFallbackRequiredByServiceWorker(false) | 102 , m_wasFallbackRequiredByServiceWorker(false) |
103 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) | 103 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) |
104 , m_responseTime(0) | 104 , m_responseTime(0) |
105 , m_remotePort(0) | 105 , m_remotePort(0) |
| 106 , m_encodedDataLength(0) |
106 , m_encodedBodyLength(0) | 107 , m_encodedBodyLength(0) |
107 , m_decodedBodyLength(0) | 108 , m_decodedBodyLength(0) |
108 { | 109 { |
109 } | 110 } |
110 | 111 |
111 ResourceResponse::ResourceResponse(const KURL& url, const AtomicString& mimeType
, long long expectedLength, const AtomicString& textEncodingName, const String&
filename) | 112 ResourceResponse::ResourceResponse(const KURL& url, const AtomicString& mimeType
, long long expectedLength, const AtomicString& textEncodingName, const String&
filename) |
112 : m_url(url) | 113 : m_url(url) |
113 , m_mimeType(mimeType) | 114 , m_mimeType(mimeType) |
114 , m_expectedContentLength(expectedLength) | 115 , m_expectedContentLength(expectedLength) |
115 , m_textEncodingName(textEncodingName) | 116 , m_textEncodingName(textEncodingName) |
(...skipping 19 matching lines...) Expand all Loading... |
135 , m_wasFetchedViaSPDY(false) | 136 , m_wasFetchedViaSPDY(false) |
136 , m_wasNpnNegotiated(false) | 137 , m_wasNpnNegotiated(false) |
137 , m_wasAlternateProtocolAvailable(false) | 138 , m_wasAlternateProtocolAvailable(false) |
138 , m_wasFetchedViaProxy(false) | 139 , m_wasFetchedViaProxy(false) |
139 , m_wasFetchedViaServiceWorker(false) | 140 , m_wasFetchedViaServiceWorker(false) |
140 , m_wasFetchedViaForeignFetch(false) | 141 , m_wasFetchedViaForeignFetch(false) |
141 , m_wasFallbackRequiredByServiceWorker(false) | 142 , m_wasFallbackRequiredByServiceWorker(false) |
142 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) | 143 , m_serviceWorkerResponseType(WebServiceWorkerResponseTypeDefault) |
143 , m_responseTime(0) | 144 , m_responseTime(0) |
144 , m_remotePort(0) | 145 , m_remotePort(0) |
| 146 , m_encodedDataLength(0) |
145 , m_encodedBodyLength(0) | 147 , m_encodedBodyLength(0) |
146 , m_decodedBodyLength(0) | 148 , m_decodedBodyLength(0) |
147 { | 149 { |
148 } | 150 } |
149 | 151 |
150 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) | 152 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) |
151 : ResourceResponse() | 153 : ResourceResponse() |
152 { | 154 { |
153 setURL(data->m_url); | 155 setURL(data->m_url); |
154 setMimeType(AtomicString(data->m_mimeType)); | 156 setMimeType(AtomicString(data->m_mimeType)); |
(...skipping 26 matching lines...) Expand all Loading... |
181 m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; | 183 m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; |
182 m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; | 184 m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; |
183 m_wasFetchedViaForeignFetch = data->m_wasFetchedViaForeignFetch; | 185 m_wasFetchedViaForeignFetch = data->m_wasFetchedViaForeignFetch; |
184 m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceW
orker; | 186 m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceW
orker; |
185 m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; | 187 m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; |
186 m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; | 188 m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; |
187 m_cacheStorageCacheName = data->m_cacheStorageCacheName; | 189 m_cacheStorageCacheName = data->m_cacheStorageCacheName; |
188 m_responseTime = data->m_responseTime; | 190 m_responseTime = data->m_responseTime; |
189 m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); | 191 m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); |
190 m_remotePort = data->m_remotePort; | 192 m_remotePort = data->m_remotePort; |
| 193 m_encodedDataLength = data->m_encodedDataLength; |
191 m_encodedBodyLength = data->m_encodedBodyLength; | 194 m_encodedBodyLength = data->m_encodedBodyLength; |
192 m_decodedBodyLength = data->m_decodedBodyLength; | 195 m_decodedBodyLength = data->m_decodedBodyLength; |
193 m_downloadedFilePath = data->m_downloadedFilePath; | 196 m_downloadedFilePath = data->m_downloadedFilePath; |
194 m_downloadedFileHandle = data->m_downloadedFileHandle; | 197 m_downloadedFileHandle = data->m_downloadedFileHandle; |
195 | 198 |
196 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 199 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
197 // whatever values may be present in the opaque m_extraData structure. | 200 // whatever values may be present in the opaque m_extraData structure. |
198 } | 201 } |
199 | 202 |
200 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; | 203 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 data->m_wasFetchedViaProxy = m_wasFetchedViaProxy; | 236 data->m_wasFetchedViaProxy = m_wasFetchedViaProxy; |
234 data->m_wasFetchedViaServiceWorker = m_wasFetchedViaServiceWorker; | 237 data->m_wasFetchedViaServiceWorker = m_wasFetchedViaServiceWorker; |
235 data->m_wasFetchedViaForeignFetch = m_wasFetchedViaForeignFetch; | 238 data->m_wasFetchedViaForeignFetch = m_wasFetchedViaForeignFetch; |
236 data->m_wasFallbackRequiredByServiceWorker = m_wasFallbackRequiredByServiceW
orker; | 239 data->m_wasFallbackRequiredByServiceWorker = m_wasFallbackRequiredByServiceW
orker; |
237 data->m_serviceWorkerResponseType = m_serviceWorkerResponseType; | 240 data->m_serviceWorkerResponseType = m_serviceWorkerResponseType; |
238 data->m_originalURLViaServiceWorker = m_originalURLViaServiceWorker.copy(); | 241 data->m_originalURLViaServiceWorker = m_originalURLViaServiceWorker.copy(); |
239 data->m_cacheStorageCacheName = cacheStorageCacheName().isolatedCopy(); | 242 data->m_cacheStorageCacheName = cacheStorageCacheName().isolatedCopy(); |
240 data->m_responseTime = m_responseTime; | 243 data->m_responseTime = m_responseTime; |
241 data->m_remoteIPAddress = m_remoteIPAddress.getString().isolatedCopy(); | 244 data->m_remoteIPAddress = m_remoteIPAddress.getString().isolatedCopy(); |
242 data->m_remotePort = m_remotePort; | 245 data->m_remotePort = m_remotePort; |
| 246 data->m_encodedDataLength = m_encodedDataLength; |
243 data->m_encodedBodyLength = m_encodedBodyLength; | 247 data->m_encodedBodyLength = m_encodedBodyLength; |
244 data->m_decodedBodyLength = m_decodedBodyLength; | 248 data->m_decodedBodyLength = m_decodedBodyLength; |
245 data->m_downloadedFilePath = m_downloadedFilePath.isolatedCopy(); | 249 data->m_downloadedFilePath = m_downloadedFilePath.isolatedCopy(); |
246 data->m_downloadedFileHandle = m_downloadedFileHandle; | 250 data->m_downloadedFileHandle = m_downloadedFileHandle; |
247 | 251 |
248 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 252 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
249 // whatever values may be present in the opaque m_extraData structure. | 253 // whatever values may be present in the opaque m_extraData structure. |
250 | 254 |
251 return data; | 255 return data; |
252 } | 256 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 PassRefPtr<ResourceLoadInfo> ResourceResponse::resourceLoadInfo() const | 583 PassRefPtr<ResourceLoadInfo> ResourceResponse::resourceLoadInfo() const |
580 { | 584 { |
581 return m_resourceLoadInfo.get(); | 585 return m_resourceLoadInfo.get(); |
582 } | 586 } |
583 | 587 |
584 void ResourceResponse::setResourceLoadInfo(PassRefPtr<ResourceLoadInfo> loadInfo
) | 588 void ResourceResponse::setResourceLoadInfo(PassRefPtr<ResourceLoadInfo> loadInfo
) |
585 { | 589 { |
586 m_resourceLoadInfo = loadInfo; | 590 m_resourceLoadInfo = loadInfo; |
587 } | 591 } |
588 | 592 |
589 void ResourceResponse::addToEncodedBodyLength(int value) | 593 void ResourceResponse::addToEncodedDataLength(long long value) |
| 594 { |
| 595 m_encodedDataLength += value; |
| 596 } |
| 597 |
| 598 void ResourceResponse::addToEncodedBodyLength(long long value) |
590 { | 599 { |
591 m_encodedBodyLength += value; | 600 m_encodedBodyLength += value; |
592 } | 601 } |
593 | 602 |
594 void ResourceResponse::addToDecodedBodyLength(int value) | 603 void ResourceResponse::addToDecodedBodyLength(long long value) |
595 { | 604 { |
596 m_decodedBodyLength += value; | 605 m_decodedBodyLength += value; |
597 } | 606 } |
598 | 607 |
599 void ResourceResponse::setDownloadedFilePath(const String& downloadedFilePath) | 608 void ResourceResponse::setDownloadedFilePath(const String& downloadedFilePath) |
600 { | 609 { |
601 m_downloadedFilePath = downloadedFilePath; | 610 m_downloadedFilePath = downloadedFilePath; |
602 if (m_downloadedFilePath.isEmpty()) { | 611 if (m_downloadedFilePath.isEmpty()) { |
603 m_downloadedFileHandle.clear(); | 612 m_downloadedFileHandle.clear(); |
604 return; | 613 return; |
605 } | 614 } |
606 std::unique_ptr<BlobData> blobData = BlobData::create(); | 615 std::unique_ptr<BlobData> blobData = BlobData::create(); |
607 blobData->appendFile(m_downloadedFilePath); | 616 blobData->appendFile(m_downloadedFilePath); |
608 blobData->detachFromCurrentThread(); | 617 blobData->detachFromCurrentThread(); |
609 m_downloadedFileHandle = BlobDataHandle::create(std::move(blobData), -1); | 618 m_downloadedFileHandle = BlobDataHandle::create(std::move(blobData), -1); |
610 } | 619 } |
611 | 620 |
| 621 void ResourceResponse::appendRedirectResponse(const ResourceResponse& response) |
| 622 { |
| 623 m_redirectResponses.push_back(response); |
| 624 } |
| 625 |
612 bool ResourceResponse::compare(const ResourceResponse& a, const ResourceResponse
& b) | 626 bool ResourceResponse::compare(const ResourceResponse& a, const ResourceResponse
& b) |
613 { | 627 { |
614 if (a.isNull() != b.isNull()) | 628 if (a.isNull() != b.isNull()) |
615 return false; | 629 return false; |
616 if (a.url() != b.url()) | 630 if (a.url() != b.url()) |
617 return false; | 631 return false; |
618 if (a.mimeType() != b.mimeType()) | 632 if (a.mimeType() != b.mimeType()) |
619 return false; | 633 return false; |
620 if (a.expectedContentLength() != b.expectedContentLength()) | 634 if (a.expectedContentLength() != b.expectedContentLength()) |
621 return false; | 635 return false; |
(...skipping 12 matching lines...) Expand all Loading... |
634 if (a.resourceLoadTiming() != b.resourceLoadTiming()) | 648 if (a.resourceLoadTiming() != b.resourceLoadTiming()) |
635 return false; | 649 return false; |
636 if (a.encodedBodyLength() != b.encodedBodyLength()) | 650 if (a.encodedBodyLength() != b.encodedBodyLength()) |
637 return false; | 651 return false; |
638 if (a.decodedBodyLength() != b.decodedBodyLength()) | 652 if (a.decodedBodyLength() != b.decodedBodyLength()) |
639 return false; | 653 return false; |
640 return true; | 654 return true; |
641 } | 655 } |
642 | 656 |
643 } // namespace blink | 657 } // namespace blink |
OLD | NEW |