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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; } | 318 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; } |
319 | 319 |
320 const AtomicString& remoteIPAddress() const { return m_remoteIPAddress; } | 320 const AtomicString& remoteIPAddress() const { return m_remoteIPAddress; } |
321 void setRemoteIPAddress(const AtomicString& value) { | 321 void setRemoteIPAddress(const AtomicString& value) { |
322 m_remoteIPAddress = value; | 322 m_remoteIPAddress = value; |
323 } | 323 } |
324 | 324 |
325 unsigned short remotePort() const { return m_remotePort; } | 325 unsigned short remotePort() const { return m_remotePort; } |
326 void setRemotePort(unsigned short value) { m_remotePort = value; } | 326 void setRemotePort(unsigned short value) { m_remotePort = value; } |
327 | 327 |
| 328 long long encodedDataLength() const { return m_encodedDataLength; } |
| 329 void addToEncodedDataLength(long long value); |
| 330 |
328 long long encodedBodyLength() const { return m_encodedBodyLength; } | 331 long long encodedBodyLength() const { return m_encodedBodyLength; } |
329 void addToEncodedBodyLength(int value); | 332 void addToEncodedBodyLength(long long value); |
330 | 333 |
331 long long decodedBodyLength() const { return m_decodedBodyLength; } | 334 long long decodedBodyLength() const { return m_decodedBodyLength; } |
332 void addToDecodedBodyLength(int value); | 335 void addToDecodedBodyLength(long long value); |
333 | 336 |
334 const String& downloadedFilePath() const { return m_downloadedFilePath; } | 337 const String& downloadedFilePath() const { return m_downloadedFilePath; } |
335 void setDownloadedFilePath(const String&); | 338 void setDownloadedFilePath(const String&); |
336 | 339 |
337 // Extra data associated with this response. | 340 // Extra data associated with this response. |
338 ExtraData* getExtraData() const { return m_extraData.get(); } | 341 ExtraData* getExtraData() const { return m_extraData.get(); } |
339 void setExtraData(PassRefPtr<ExtraData> extraData) { | 342 void setExtraData(PassRefPtr<ExtraData> extraData) { |
340 m_extraData = extraData; | 343 m_extraData = extraData; |
341 } | 344 } |
342 | 345 |
343 unsigned memoryUsage() const { | 346 unsigned memoryUsage() const { |
344 // average size, mostly due to URL and Header Map strings | 347 // average size, mostly due to URL and Header Map strings |
345 return 1280; | 348 return 1280; |
346 } | 349 } |
347 | 350 |
| 351 // PlzNavigate: Even if there is redirections, only one |
| 352 // ResourceResponse is built: the final response. |
| 353 // The redirect response chain can be accessed by this function. |
| 354 const Vector<ResourceResponse>& redirectResponses() const { |
| 355 return m_redirectResponses; |
| 356 } |
| 357 void appendRedirectResponse(const ResourceResponse&); |
| 358 |
348 // This method doesn't compare the all members. | 359 // This method doesn't compare the all members. |
349 static bool compare(const ResourceResponse&, const ResourceResponse&); | 360 static bool compare(const ResourceResponse&, const ResourceResponse&); |
350 | 361 |
351 private: | 362 private: |
352 void updateHeaderParsedState(const AtomicString& name); | 363 void updateHeaderParsedState(const AtomicString& name); |
353 | 364 |
354 KURL m_url; | 365 KURL m_url; |
355 AtomicString m_mimeType; | 366 AtomicString m_mimeType; |
356 long long m_expectedContentLength; | 367 long long m_expectedContentLength; |
357 AtomicString m_textEncodingName; | 368 AtomicString m_textEncodingName; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // The time at which the response headers were received. For cached | 461 // The time at which the response headers were received. For cached |
451 // responses, this time could be "far" in the past. | 462 // responses, this time could be "far" in the past. |
452 int64_t m_responseTime; | 463 int64_t m_responseTime; |
453 | 464 |
454 // Remote IP address of the socket which fetched this resource. | 465 // Remote IP address of the socket which fetched this resource. |
455 AtomicString m_remoteIPAddress; | 466 AtomicString m_remoteIPAddress; |
456 | 467 |
457 // Remote port number of the socket which fetched this resource. | 468 // Remote port number of the socket which fetched this resource. |
458 unsigned short m_remotePort; | 469 unsigned short m_remotePort; |
459 | 470 |
| 471 // Size of the response in bytes prior to decompression. |
| 472 long long m_encodedDataLength; |
| 473 |
460 // Size of the response body in bytes prior to decompression. | 474 // Size of the response body in bytes prior to decompression. |
461 long long m_encodedBodyLength; | 475 long long m_encodedBodyLength; |
462 | 476 |
463 // Sizes of the response body in bytes after any content-encoding is | 477 // Sizes of the response body in bytes after any content-encoding is |
464 // removed. | 478 // removed. |
465 long long m_decodedBodyLength; | 479 long long m_decodedBodyLength; |
466 | 480 |
467 // The downloaded file path if the load streamed to a file. | 481 // The downloaded file path if the load streamed to a file. |
468 String m_downloadedFilePath; | 482 String m_downloadedFilePath; |
469 | 483 |
470 // The handle to the downloaded file to ensure the underlying file will not | 484 // The handle to the downloaded file to ensure the underlying file will not |
471 // be deleted. | 485 // be deleted. |
472 RefPtr<BlobDataHandle> m_downloadedFileHandle; | 486 RefPtr<BlobDataHandle> m_downloadedFileHandle; |
473 | 487 |
474 // ExtraData associated with the response. | 488 // ExtraData associated with the response. |
475 RefPtr<ExtraData> m_extraData; | 489 RefPtr<ExtraData> m_extraData; |
| 490 |
| 491 // PlzNavigate: the redirect responses are transmitted |
| 492 // inside the final response. |
| 493 Vector<ResourceResponse> m_redirectResponses; |
476 }; | 494 }; |
477 | 495 |
478 inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { | 496 inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { |
479 return ResourceResponse::compare(a, b); | 497 return ResourceResponse::compare(a, b); |
480 } | 498 } |
481 inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { | 499 inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { |
482 return !(a == b); | 500 return !(a == b); |
483 } | 501 } |
484 | 502 |
485 struct CrossThreadResourceResponseData { | 503 struct CrossThreadResourceResponseData { |
(...skipping 28 matching lines...) Expand all Loading... |
514 bool m_wasFetchedViaProxy; | 532 bool m_wasFetchedViaProxy; |
515 bool m_wasFetchedViaServiceWorker; | 533 bool m_wasFetchedViaServiceWorker; |
516 bool m_wasFetchedViaForeignFetch; | 534 bool m_wasFetchedViaForeignFetch; |
517 bool m_wasFallbackRequiredByServiceWorker; | 535 bool m_wasFallbackRequiredByServiceWorker; |
518 WebServiceWorkerResponseType m_serviceWorkerResponseType; | 536 WebServiceWorkerResponseType m_serviceWorkerResponseType; |
519 KURL m_originalURLViaServiceWorker; | 537 KURL m_originalURLViaServiceWorker; |
520 String m_cacheStorageCacheName; | 538 String m_cacheStorageCacheName; |
521 int64_t m_responseTime; | 539 int64_t m_responseTime; |
522 String m_remoteIPAddress; | 540 String m_remoteIPAddress; |
523 unsigned short m_remotePort; | 541 unsigned short m_remotePort; |
| 542 long long m_encodedDataLength; |
524 long long m_encodedBodyLength; | 543 long long m_encodedBodyLength; |
525 long long m_decodedBodyLength; | 544 long long m_decodedBodyLength; |
526 String m_downloadedFilePath; | 545 String m_downloadedFilePath; |
527 RefPtr<BlobDataHandle> m_downloadedFileHandle; | 546 RefPtr<BlobDataHandle> m_downloadedFileHandle; |
528 }; | 547 }; |
529 | 548 |
530 } // namespace blink | 549 } // namespace blink |
531 | 550 |
532 #endif // ResourceResponse_h | 551 #endif // ResourceResponse_h |
OLD | NEW |