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

Side by Side Diff: third_party/WebKit/Source/platform/network/ResourceResponse.h

Issue 2316573002: PlzNavigate: Support ResourceTiming API (Closed)
Patch Set: Move redirect response inside the final response. Created 4 years, 3 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 /* 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 int64_t responseTime() const { return m_responseTime; } 272 int64_t responseTime() const { return m_responseTime; }
273 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; } 273 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; }
274 274
275 const AtomicString& remoteIPAddress() const { return m_remoteIPAddress; } 275 const AtomicString& remoteIPAddress() const { return m_remoteIPAddress; }
276 void setRemoteIPAddress(const AtomicString& value) { m_remoteIPAddress = val ue; } 276 void setRemoteIPAddress(const AtomicString& value) { m_remoteIPAddress = val ue; }
277 277
278 unsigned short remotePort() const { return m_remotePort; } 278 unsigned short remotePort() const { return m_remotePort; }
279 void setRemotePort(unsigned short value) { m_remotePort = value; } 279 void setRemotePort(unsigned short value) { m_remotePort = value; }
280 280
281 long long encodedDataLength() const { return m_encodedDataLength; }
282 void addToEncodedDataLength(long long value);
283
281 long long encodedBodyLength() const { return m_encodedBodyLength; } 284 long long encodedBodyLength() const { return m_encodedBodyLength; }
282 void addToEncodedBodyLength(int value); 285 void addToEncodedBodyLength(long long value);
283 286
284 long long decodedBodyLength() const { return m_decodedBodyLength; } 287 long long decodedBodyLength() const { return m_decodedBodyLength; }
285 void addToDecodedBodyLength(int value); 288 void addToDecodedBodyLength(long long value);
286 289
287 const String& downloadedFilePath() const { return m_downloadedFilePath; } 290 const String& downloadedFilePath() const { return m_downloadedFilePath; }
288 void setDownloadedFilePath(const String&); 291 void setDownloadedFilePath(const String&);
289 292
290 // Extra data associated with this response. 293 // Extra data associated with this response.
291 ExtraData* getExtraData() const { return m_extraData.get(); } 294 ExtraData* getExtraData() const { return m_extraData.get(); }
292 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; } 295 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; }
293 296
294 unsigned memoryUsage() const 297 unsigned memoryUsage() const
295 { 298 {
296 // average size, mostly due to URL and Header Map strings 299 // average size, mostly due to URL and Header Map strings
297 return 1280; 300 return 1280;
298 } 301 }
299 302
303 // PlzNavigate: Even if there is redirections, only one
304 // ResourceResponse is built: the final response.
305 // The redirect response chain can be accessed by this function.
306 const std::vector<ResourceResponse>& redirectResponses() const { return m_re directResponses; }
Nate Chapin 2016/09/08 18:41:13 WTF::Vector instead of std::vector in blink. Legac
arthursonzogni 2016/09/09 12:45:33 Done.
307 void appendRedirectResponse(const ResourceResponse&);
308
300 // This method doesn't compare the all members. 309 // This method doesn't compare the all members.
301 static bool compare(const ResourceResponse&, const ResourceResponse&); 310 static bool compare(const ResourceResponse&, const ResourceResponse&);
302 311
303 private: 312 private:
304 void updateHeaderParsedState(const AtomicString& name); 313 void updateHeaderParsedState(const AtomicString& name);
305 314
306 KURL m_url; 315 KURL m_url;
307 AtomicString m_mimeType; 316 AtomicString m_mimeType;
308 long long m_expectedContentLength; 317 long long m_expectedContentLength;
309 AtomicString m_textEncodingName; 318 AtomicString m_textEncodingName;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // The time at which the response headers were received. For cached 414 // The time at which the response headers were received. For cached
406 // responses, this time could be "far" in the past. 415 // responses, this time could be "far" in the past.
407 int64_t m_responseTime; 416 int64_t m_responseTime;
408 417
409 // Remote IP address of the socket which fetched this resource. 418 // Remote IP address of the socket which fetched this resource.
410 AtomicString m_remoteIPAddress; 419 AtomicString m_remoteIPAddress;
411 420
412 // Remote port number of the socket which fetched this resource. 421 // Remote port number of the socket which fetched this resource.
413 unsigned short m_remotePort; 422 unsigned short m_remotePort;
414 423
424 // Size of the response in bytes prior to decompression.
425 long long m_encodedDataLength;
426
415 // Size of the response body in bytes prior to decompression. 427 // Size of the response body in bytes prior to decompression.
416 long long m_encodedBodyLength; 428 long long m_encodedBodyLength;
417 429
418 // Sizes of the response body in bytes after any content-encoding is 430 // Sizes of the response body in bytes after any content-encoding is
419 // removed. 431 // removed.
420 long long m_decodedBodyLength; 432 long long m_decodedBodyLength;
421 433
422 // The downloaded file path if the load streamed to a file. 434 // The downloaded file path if the load streamed to a file.
423 String m_downloadedFilePath; 435 String m_downloadedFilePath;
424 436
425 // The handle to the downloaded file to ensure the underlying file will not 437 // The handle to the downloaded file to ensure the underlying file will not
426 // be deleted. 438 // be deleted.
427 RefPtr<BlobDataHandle> m_downloadedFileHandle; 439 RefPtr<BlobDataHandle> m_downloadedFileHandle;
428 440
429 // ExtraData associated with the response. 441 // ExtraData associated with the response.
430 RefPtr<ExtraData> m_extraData; 442 RefPtr<ExtraData> m_extraData;
443
444 // PlzNavigate: the redirect responses are transmitted
445 // inside the final response.
446 std::vector<ResourceResponse> m_redirectResponses;
431 }; 447 };
432 448
433 inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { r eturn ResourceResponse::compare(a, b); } 449 inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { r eturn ResourceResponse::compare(a, b); }
434 inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { r eturn !(a == b); } 450 inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { r eturn !(a == b); }
435 451
436 struct CrossThreadResourceResponseData { 452 struct CrossThreadResourceResponseData {
437 WTF_MAKE_NONCOPYABLE(CrossThreadResourceResponseData); USING_FAST_MALLOC(Cro ssThreadResourceResponseData); 453 WTF_MAKE_NONCOPYABLE(CrossThreadResourceResponseData); USING_FAST_MALLOC(Cro ssThreadResourceResponseData);
438 public: 454 public:
439 CrossThreadResourceResponseData() { } 455 CrossThreadResourceResponseData() { }
440 KURL m_url; 456 KURL m_url;
(...skipping 20 matching lines...) Expand all
461 bool m_wasFetchedViaProxy; 477 bool m_wasFetchedViaProxy;
462 bool m_wasFetchedViaServiceWorker; 478 bool m_wasFetchedViaServiceWorker;
463 bool m_wasFetchedViaForeignFetch; 479 bool m_wasFetchedViaForeignFetch;
464 bool m_wasFallbackRequiredByServiceWorker; 480 bool m_wasFallbackRequiredByServiceWorker;
465 WebServiceWorkerResponseType m_serviceWorkerResponseType; 481 WebServiceWorkerResponseType m_serviceWorkerResponseType;
466 KURL m_originalURLViaServiceWorker; 482 KURL m_originalURLViaServiceWorker;
467 String m_cacheStorageCacheName; 483 String m_cacheStorageCacheName;
468 int64_t m_responseTime; 484 int64_t m_responseTime;
469 String m_remoteIPAddress; 485 String m_remoteIPAddress;
470 unsigned short m_remotePort; 486 unsigned short m_remotePort;
487 long long m_encodedDataLength;
471 long long m_encodedBodyLength; 488 long long m_encodedBodyLength;
472 long long m_decodedBodyLength; 489 long long m_decodedBodyLength;
473 String m_downloadedFilePath; 490 String m_downloadedFilePath;
474 RefPtr<BlobDataHandle> m_downloadedFileHandle; 491 RefPtr<BlobDataHandle> m_downloadedFileHandle;
475 }; 492 };
476 493
477 } // namespace blink 494 } // namespace blink
478 495
479 #endif // ResourceResponse_h 496 #endif // ResourceResponse_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698