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

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

Issue 1750333002: Reland 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;
171 172
172 switch (m_type) { 173 switch (m_type) {
173 case BasicType: 174 case BasicType:
174 case CORSType: 175 case CORSType:
175 ASSERT(m_internalResponse); 176 ASSERT(m_internalResponse);
176 ASSERT(m_buffer == m_internalResponse->m_buffer); 177 ASSERT(m_buffer == m_internalResponse->m_buffer);
177 ASSERT(m_internalResponse->m_type == DefaultType); 178 ASSERT(m_internalResponse->m_type == DefaultType);
178 newResponse->m_internalResponse = m_internalResponse->clone(executionCon text); 179 newResponse->m_internalResponse = m_internalResponse->clone(executionCon text);
179 m_buffer = m_internalResponse->m_buffer; 180 m_buffer = m_internalResponse->m_buffer;
180 newResponse->m_buffer = newResponse->m_internalResponse->m_buffer; 181 newResponse->m_buffer = newResponse->m_internalResponse->m_buffer;
(...skipping 28 matching lines...) Expand all
209 if (m_internalResponse) { 210 if (m_internalResponse) {
210 m_internalResponse->populateWebServiceWorkerResponse(response); 211 m_internalResponse->populateWebServiceWorkerResponse(response);
211 response.setResponseType(fetchTypeToWebType(m_type)); 212 response.setResponseType(fetchTypeToWebType(m_type));
212 return; 213 return;
213 } 214 }
214 215
215 response.setURL(url()); 216 response.setURL(url());
216 response.setStatus(status()); 217 response.setStatus(status());
217 response.setStatusText(statusMessage()); 218 response.setStatusText(statusMessage());
218 response.setResponseType(fetchTypeToWebType(m_type)); 219 response.setResponseType(fetchTypeToWebType(m_type));
220 response.setResponseTime(responseTime());
219 for (size_t i = 0; i < headerList()->size(); ++i) { 221 for (size_t i = 0; i < headerList()->size(); ++i) {
220 const FetchHeaderList::Header* header = headerList()->list()[i].get(); 222 const FetchHeaderList::Header* header = headerList()->list()[i].get();
221 response.appendHeader(header->first, header->second); 223 response.appendHeader(header->first, header->second);
222 } 224 }
223 } 225 }
224 226
225 FetchResponseData::FetchResponseData(Type type, unsigned short status, AtomicStr ing statusMessage) 227 FetchResponseData::FetchResponseData(Type type, unsigned short status, AtomicStr ing statusMessage)
226 : m_type(type) 228 : m_type(type)
227 , m_status(status) 229 , m_status(status)
228 , m_statusMessage(statusMessage) 230 , m_statusMessage(statusMessage)
229 , m_headerList(FetchHeaderList::create()) 231 , m_headerList(FetchHeaderList::create())
232 , m_responseTime(0)
230 { 233 {
231 } 234 }
232 235
233 void FetchResponseData::replaceBodyStreamBuffer(BodyStreamBuffer* buffer) 236 void FetchResponseData::replaceBodyStreamBuffer(BodyStreamBuffer* buffer)
234 { 237 {
235 if (m_type == BasicType || m_type == CORSType) { 238 if (m_type == BasicType || m_type == CORSType) {
236 ASSERT(m_internalResponse); 239 ASSERT(m_internalResponse);
237 m_internalResponse->m_buffer = buffer; 240 m_internalResponse->m_buffer = buffer;
238 m_buffer = buffer; 241 m_buffer = buffer;
239 } else if (m_type == DefaultType) { 242 } else if (m_type == DefaultType) {
240 ASSERT(!m_internalResponse); 243 ASSERT(!m_internalResponse);
241 m_buffer = buffer; 244 m_buffer = buffer;
242 } 245 }
243 } 246 }
244 247
245 DEFINE_TRACE(FetchResponseData) 248 DEFINE_TRACE(FetchResponseData)
246 { 249 {
247 visitor->trace(m_headerList); 250 visitor->trace(m_headerList);
248 visitor->trace(m_internalResponse); 251 visitor->trace(m_internalResponse);
249 visitor->trace(m_buffer); 252 visitor->trace(m_buffer);
250 } 253 }
251 254
252 } // namespace blink 255 } // 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