Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp

Issue 1746483002: Revert of Pipe response_time from FetchManager to CacheStorage and ServiceWorkerURLRequestJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/FetchResponseData.h" 5 #include "modules/fetch/FetchResponseData.h"
6 6
7 #include "core/dom/DOMArrayBuffer.h" 7 #include "core/dom/DOMArrayBuffer.h"
8 #include "core/fetch/CrossOriginAccessControl.h" 8 #include "core/fetch/CrossOriginAccessControl.h"
9 #include "core/fetch/FetchUtils.h" 9 #include "core/fetch/FetchUtils.h"
10 #include "modules/fetch/BodyStreamBuffer.h" 10 #include "modules/fetch/BodyStreamBuffer.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 newResponse->m_type = m_type; 161 newResponse->m_type = m_type;
162 if (m_terminationReason) { 162 if (m_terminationReason) {
163 newResponse->m_terminationReason = adoptPtr(new TerminationReason); 163 newResponse->m_terminationReason = adoptPtr(new TerminationReason);
164 *newResponse->m_terminationReason = *m_terminationReason; 164 *newResponse->m_terminationReason = *m_terminationReason;
165 } 165 }
166 newResponse->m_url = m_url; 166 newResponse->m_url = m_url;
167 newResponse->m_status = m_status; 167 newResponse->m_status = m_status;
168 newResponse->m_statusMessage = m_statusMessage; 168 newResponse->m_statusMessage = m_statusMessage;
169 newResponse->m_headerList = m_headerList->clone(); 169 newResponse->m_headerList = m_headerList->clone();
170 newResponse->m_mimeType = m_mimeType; 170 newResponse->m_mimeType = m_mimeType;
171 newResponse->m_responseTime = m_responseTime;
172 171
173 switch (m_type) { 172 switch (m_type) {
174 case BasicType: 173 case BasicType:
175 case CORSType: 174 case CORSType:
176 ASSERT(m_internalResponse); 175 ASSERT(m_internalResponse);
177 ASSERT(m_buffer == m_internalResponse->m_buffer); 176 ASSERT(m_buffer == m_internalResponse->m_buffer);
178 ASSERT(m_internalResponse->m_type == DefaultType); 177 ASSERT(m_internalResponse->m_type == DefaultType);
179 newResponse->m_internalResponse = m_internalResponse->clone(executionCon text); 178 newResponse->m_internalResponse = m_internalResponse->clone(executionCon text);
180 m_buffer = m_internalResponse->m_buffer; 179 m_buffer = m_internalResponse->m_buffer;
181 newResponse->m_buffer = newResponse->m_internalResponse->m_buffer; 180 newResponse->m_buffer = newResponse->m_internalResponse->m_buffer;
(...skipping 28 matching lines...) Expand all
210 if (m_internalResponse) { 209 if (m_internalResponse) {
211 m_internalResponse->populateWebServiceWorkerResponse(response); 210 m_internalResponse->populateWebServiceWorkerResponse(response);
212 response.setResponseType(fetchTypeToWebType(m_type)); 211 response.setResponseType(fetchTypeToWebType(m_type));
213 return; 212 return;
214 } 213 }
215 214
216 response.setURL(url()); 215 response.setURL(url());
217 response.setStatus(status()); 216 response.setStatus(status());
218 response.setStatusText(statusMessage()); 217 response.setStatusText(statusMessage());
219 response.setResponseType(fetchTypeToWebType(m_type)); 218 response.setResponseType(fetchTypeToWebType(m_type));
220 response.setResponseTime(responseTime());
221 for (size_t i = 0; i < headerList()->size(); ++i) { 219 for (size_t i = 0; i < headerList()->size(); ++i) {
222 const FetchHeaderList::Header* header = headerList()->list()[i].get(); 220 const FetchHeaderList::Header* header = headerList()->list()[i].get();
223 response.appendHeader(header->first, header->second); 221 response.appendHeader(header->first, header->second);
224 } 222 }
225 } 223 }
226 224
227 FetchResponseData::FetchResponseData(Type type, unsigned short status, AtomicStr ing statusMessage) 225 FetchResponseData::FetchResponseData(Type type, unsigned short status, AtomicStr ing statusMessage)
228 : m_type(type) 226 : m_type(type)
229 , m_status(status) 227 , m_status(status)
230 , m_statusMessage(statusMessage) 228 , m_statusMessage(statusMessage)
231 , m_headerList(FetchHeaderList::create()) 229 , m_headerList(FetchHeaderList::create())
232 , m_responseTime(0)
233 { 230 {
234 } 231 }
235 232
236 void FetchResponseData::replaceBodyStreamBuffer(BodyStreamBuffer* buffer) 233 void FetchResponseData::replaceBodyStreamBuffer(BodyStreamBuffer* buffer)
237 { 234 {
238 if (m_type == BasicType || m_type == CORSType) { 235 if (m_type == BasicType || m_type == CORSType) {
239 ASSERT(m_internalResponse); 236 ASSERT(m_internalResponse);
240 m_internalResponse->m_buffer = buffer; 237 m_internalResponse->m_buffer = buffer;
241 m_buffer = buffer; 238 m_buffer = buffer;
242 } else if (m_type == DefaultType) { 239 } else if (m_type == DefaultType) {
243 ASSERT(!m_internalResponse); 240 ASSERT(!m_internalResponse);
244 m_buffer = buffer; 241 m_buffer = buffer;
245 } 242 }
246 } 243 }
247 244
248 DEFINE_TRACE(FetchResponseData) 245 DEFINE_TRACE(FetchResponseData)
249 { 246 {
250 visitor->trace(m_headerList); 247 visitor->trace(m_headerList);
251 visitor->trace(m_internalResponse); 248 visitor->trace(m_internalResponse);
252 visitor->trace(m_buffer); 249 visitor->trace(m_buffer);
253 } 250 }
254 251
255 } // namespace blink 252 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchResponseData.h ('k') | third_party/WebKit/Source/modules/fetch/Response.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698