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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/Resource.h

Issue 2920663002: Class/struct layout optimization for blink Resource related classes (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/loader/fetch/Resource.h
diff --git a/third_party/WebKit/Source/platform/loader/fetch/Resource.h b/third_party/WebKit/Source/platform/loader/fetch/Resource.h
index 537d295485a5693ab14c937d77bd04f72eb61a1c..9957e5ab8b6f6b12d2049d25c239b065fbeb2a68 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/Resource.h
+++ b/third_party/WebKit/Source/platform/loader/fetch/Resource.h
@@ -69,7 +69,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
// |Type| enum values are used in UMAs, so do not change the values of
// existing |Type|. When adding a new |Type|, append it at the end and update
// |kLastResourceType|.
- enum Type {
+ enum Type : uint8_t {
kMainResource,
kImage,
kCSSStyleSheet,
@@ -157,7 +157,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
void AddClient(ResourceClient*, PreloadReferencePolicy = kMarkAsReferenced);
void RemoveClient(ResourceClient*);
- enum PreloadResult {
+ enum PreloadResult : uint8_t {
kPreloadNotReferenced,
kPreloadReferenced,
kPreloadReferencedWhileLoading,
@@ -429,6 +429,20 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
// MemoryCoordinatorClient overrides:
void OnPurgeMemory() override;
+ PreloadResult preload_result_;
+ Type type_;
+ ResourceStatus status_;
+
+ bool needs_synchronous_cache_hit_ : 1;
dcheng 2017/06/05 18:15:40 Is the bitfield packing necessary? We don't pack e
stanisc 2017/06/06 22:47:55 Not necessary in this particular case. I was debat
dcheng 2017/06/07 17:09:22 If I had written the CL, I probably wouldn't have
stanisc 2017/06/08 21:34:03 OK, I've removed bitfields because that has been s
+ bool link_preload_ : 1;
+ bool is_revalidating_ : 1;
+ bool is_alive_ : 1;
+
+ bool is_add_remove_client_prohibited_;
+ bool is_revalidation_start_forbidden_ = false;
+
+ ResourceIntegrityDisposition integrity_disposition_;
dcheng 2017/06/07 17:09:22 This IMO is the big disadvantage of reordering fie
stanisc 2017/06/08 21:34:03 OK, moved it back.
+
Member<CachedMetadataHandlerImpl> cache_handler_;
RefPtr<SecurityOrigin> fetcher_security_origin_;
@@ -438,6 +452,9 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
unsigned long identifier_;
+ unsigned preload_count_;
+ double preload_discovery_time_;
+
size_t encoded_size_;
size_t encoded_size_memory_usage_;
size_t decoded_size_;
@@ -448,24 +465,8 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
// and thus potential bugs. crbug.com/594644
const size_t overhead_size_;
- unsigned preload_count_;
-
- double preload_discovery_time_;
-
String cache_identifier_;
- PreloadResult preload_result_;
- Type type_;
- ResourceStatus status_;
-
- bool needs_synchronous_cache_hit_;
- bool link_preload_;
- bool is_revalidating_;
- bool is_alive_;
- bool is_add_remove_client_prohibited_;
- bool is_revalidation_start_forbidden_ = false;
-
- ResourceIntegrityDisposition integrity_disposition_;
IntegrityMetadataSet integrity_metadata_;
// Ordered list of all redirects followed while fetching this resource.

Powered by Google App Engine
This is Rietveld 408576698