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

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

Issue 2920663002: Class/struct layout optimization for blink Resource related classes (Closed)
Patch Set: Rebase Created 3 years, 6 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h" 42 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 struct CrossThreadResourceResponseData; 46 struct CrossThreadResourceResponseData;
47 47
48 class PLATFORM_EXPORT ResourceResponse final { 48 class PLATFORM_EXPORT ResourceResponse final {
49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
50 50
51 public: 51 public:
52 enum HTTPVersion { 52 enum HTTPVersion : uint8_t {
53 kHTTPVersionUnknown, 53 kHTTPVersionUnknown,
54 kHTTPVersion_0_9, 54 kHTTPVersion_0_9,
55 kHTTPVersion_1_0, 55 kHTTPVersion_1_0,
56 kHTTPVersion_1_1, 56 kHTTPVersion_1_1,
57 kHTTPVersion_2_0 57 kHTTPVersion_2_0
58 }; 58 };
59 enum SecurityStyle { 59 enum SecurityStyle : uint8_t {
60 kSecurityStyleUnknown, 60 kSecurityStyleUnknown,
61 kSecurityStyleUnauthenticated, 61 kSecurityStyleUnauthenticated,
62 kSecurityStyleAuthenticationBroken, 62 kSecurityStyleAuthenticationBroken,
63 kSecurityStyleWarning, 63 kSecurityStyleWarning,
64 kSecurityStyleAuthenticated 64 kSecurityStyleAuthenticated
65 }; 65 };
66 66
67 class PLATFORM_EXPORT SignedCertificateTimestamp final { 67 class PLATFORM_EXPORT SignedCertificateTimestamp final {
68 public: 68 public:
69 SignedCertificateTimestamp(String status, 69 SignedCertificateTimestamp(String status,
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // This method doesn't compare the all members. 375 // This method doesn't compare the all members.
376 static bool Compare(const ResourceResponse&, const ResourceResponse&); 376 static bool Compare(const ResourceResponse&, const ResourceResponse&);
377 377
378 private: 378 private:
379 void UpdateHeaderParsedState(const AtomicString& name); 379 void UpdateHeaderParsedState(const AtomicString& name);
380 380
381 KURL url_; 381 KURL url_;
382 AtomicString mime_type_; 382 AtomicString mime_type_;
383 long long expected_content_length_; 383 long long expected_content_length_;
384 AtomicString text_encoding_name_; 384 AtomicString text_encoding_name_;
385 unsigned connection_id_;
385 int http_status_code_; 386 int http_status_code_;
386 AtomicString http_status_text_; 387 AtomicString http_status_text_;
387 HTTPHeaderMap http_header_fields_; 388 HTTPHeaderMap http_header_fields_;
389
390 // Remote IP address of the socket which fetched this resource.
391 AtomicString remote_ip_address_;
392
393 // Remote port number of the socket which fetched this resource.
394 unsigned short remote_port_;
395
388 bool was_cached_ : 1; 396 bool was_cached_ : 1;
389 unsigned connection_id_;
390 bool connection_reused_ : 1; 397 bool connection_reused_ : 1;
391 RefPtr<ResourceLoadTiming> resource_load_timing_;
392 RefPtr<ResourceLoadInfo> resource_load_info_;
393
394 bool is_null_ : 1; 398 bool is_null_ : 1;
395
396 mutable CacheControlHeader cache_control_header_;
397
398 mutable bool have_parsed_age_header_ : 1; 399 mutable bool have_parsed_age_header_ : 1;
399 mutable bool have_parsed_date_header_ : 1; 400 mutable bool have_parsed_date_header_ : 1;
400 mutable bool have_parsed_expires_header_ : 1; 401 mutable bool have_parsed_expires_header_ : 1;
401 mutable bool have_parsed_last_modified_header_ : 1; 402 mutable bool have_parsed_last_modified_header_ : 1;
402 403
403 mutable double age_;
404 mutable double date_;
405 mutable double expires_;
406 mutable double last_modified_;
407
408 // True if the resource was retrieved by the embedder in spite of 404 // True if the resource was retrieved by the embedder in spite of
409 // certificate errors. 405 // certificate errors.
410 bool has_major_certificate_errors_; 406 bool has_major_certificate_errors_ : 1;
407
408 // Was the resource fetched over SPDY. See http://dev.chromium.org/spdy
409 bool was_fetched_via_spdy_ : 1;
410
411 // Was the resource fetched over an explicit proxy (HTTP, SOCKS, etc).
412 bool was_fetched_via_proxy_ : 1;
413
414 // Was the resource fetched over a ServiceWorker.
415 bool was_fetched_via_service_worker_ : 1;
416
417 // Was the resource fetched using a foreign fetch service worker.
418 bool was_fetched_via_foreign_fetch_ : 1;
419
420 // Was the fallback request with skip service worker flag required.
421 bool was_fallback_required_by_service_worker_ : 1;
422
423 // True if service worker navigation preload was performed due to
424 // the request for this resource.
425 bool did_service_worker_navigation_preload_ : 1;
426
427 // The type of the response which was fetched by the ServiceWorker.
428 WebServiceWorkerResponseType service_worker_response_type_;
429
430 // HTTP version used in the response, if known.
431 HTTPVersion http_version_;
411 432
412 // The security style of the resource. 433 // The security style of the resource.
413 // This only contains a valid value when the DevTools Network domain is 434 // This only contains a valid value when the DevTools Network domain is
414 // enabled. (Otherwise, it contains a default value of Unknown.) 435 // enabled. (Otherwise, it contains a default value of Unknown.)
415 SecurityStyle security_style_; 436 SecurityStyle security_style_;
416 437
417 // Security details of this request's connection. 438 // Security details of this request's connection.
418 // If m_securityStyle is Unknown or Unauthenticated, this does not contain 439 // If m_securityStyle is Unknown or Unauthenticated, this does not contain
419 // valid data. 440 // valid data.
420 SecurityDetails security_details_; 441 SecurityDetails security_details_;
421 442
422 // HTTP version used in the response, if known. 443 RefPtr<ResourceLoadTiming> resource_load_timing_;
423 HTTPVersion http_version_; 444 RefPtr<ResourceLoadInfo> resource_load_info_;
445
446 mutable CacheControlHeader cache_control_header_;
447
448 mutable double age_;
449 mutable double date_;
450 mutable double expires_;
451 mutable double last_modified_;
424 452
425 // The id of the appcache this response was retrieved from, or zero if 453 // The id of the appcache this response was retrieved from, or zero if
426 // the response was not retrieved from an appcache. 454 // the response was not retrieved from an appcache.
427 long long app_cache_id_; 455 long long app_cache_id_;
428 456
429 // The manifest url of the appcache this response was retrieved from, if any. 457 // The manifest url of the appcache this response was retrieved from, if any.
430 // Note: only valid for main resource responses. 458 // Note: only valid for main resource responses.
431 KURL app_cache_manifest_url_; 459 KURL app_cache_manifest_url_;
432 460
433 // The multipart boundary of this response. 461 // The multipart boundary of this response.
434 Vector<char> multipart_boundary_; 462 Vector<char> multipart_boundary_;
435 463
436 // Was the resource fetched over SPDY. See http://dev.chromium.org/spdy
437 bool was_fetched_via_spdy_;
438
439 // Was the resource fetched over an explicit proxy (HTTP, SOCKS, etc).
440 bool was_fetched_via_proxy_;
441
442 // Was the resource fetched over a ServiceWorker.
443 bool was_fetched_via_service_worker_;
444
445 // Was the resource fetched using a foreign fetch service worker.
446 bool was_fetched_via_foreign_fetch_;
447
448 // Was the fallback request with skip service worker flag required.
449 bool was_fallback_required_by_service_worker_;
450
451 // The type of the response which was fetched by the ServiceWorker.
452 WebServiceWorkerResponseType service_worker_response_type_;
453
454 // The URL list of the response which was fetched by the ServiceWorker. 464 // The URL list of the response which was fetched by the ServiceWorker.
455 // This is empty if the response was created inside the ServiceWorker. 465 // This is empty if the response was created inside the ServiceWorker.
456 Vector<KURL> url_list_via_service_worker_; 466 Vector<KURL> url_list_via_service_worker_;
457 467
458 // The cache name of the CacheStorage from where the response is served via 468 // The cache name of the CacheStorage from where the response is served via
459 // the ServiceWorker. Null if the response isn't from the CacheStorage. 469 // the ServiceWorker. Null if the response isn't from the CacheStorage.
460 String cache_storage_cache_name_; 470 String cache_storage_cache_name_;
461 471
462 // The headers that should be exposed according to CORS. Only guaranteed 472 // The headers that should be exposed according to CORS. Only guaranteed
463 // to be set if the response was fetched by a ServiceWorker. 473 // to be set if the response was fetched by a ServiceWorker.
464 Vector<String> cors_exposed_header_names_; 474 Vector<String> cors_exposed_header_names_;
465 475
466 // True if service worker navigation preload was performed due to
467 // the request for this resource.
468 bool did_service_worker_navigation_preload_;
469
470 // The time at which the response headers were received. For cached 476 // The time at which the response headers were received. For cached
471 // responses, this time could be "far" in the past. 477 // responses, this time could be "far" in the past.
472 int64_t response_time_; 478 int64_t response_time_;
473 479
474 // Remote IP address of the socket which fetched this resource.
475 AtomicString remote_ip_address_;
476
477 // Remote port number of the socket which fetched this resource.
478 unsigned short remote_port_;
479
480 // Size of the response in bytes prior to decompression. 480 // Size of the response in bytes prior to decompression.
481 long long encoded_data_length_; 481 long long encoded_data_length_;
482 482
483 // Size of the response body in bytes prior to decompression. 483 // Size of the response body in bytes prior to decompression.
484 long long encoded_body_length_; 484 long long encoded_body_length_;
485 485
486 // Sizes of the response body in bytes after any content-encoding is 486 // Sizes of the response body in bytes after any content-encoding is
487 // removed. 487 // removed.
488 long long decoded_body_length_; 488 long long decoded_body_length_;
489 489
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 long long encoded_data_length_; 548 long long encoded_data_length_;
549 long long encoded_body_length_; 549 long long encoded_body_length_;
550 long long decoded_body_length_; 550 long long decoded_body_length_;
551 String downloaded_file_path_; 551 String downloaded_file_path_;
552 RefPtr<BlobDataHandle> downloaded_file_handle_; 552 RefPtr<BlobDataHandle> downloaded_file_handle_;
553 }; 553 };
554 554
555 } // namespace blink 555 } // namespace blink
556 556
557 #endif // ResourceResponse_h 557 #endif // ResourceResponse_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698