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

Unified Diff: content/browser/service_worker/service_worker_database.h

Issue 647953003: Service Worker script sizes in database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fixed crash where writer_ was null Created 6 years, 2 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: content/browser/service_worker/service_worker_database.h
diff --git a/content/browser/service_worker/service_worker_database.h b/content/browser/service_worker/service_worker_database.h
index 9518de078ebb8f7ba3e998c3f284f35c59c55457..59b27648155b2298d6ba4fc8cd73a4f8834602bd 100644
--- a/content/browser/service_worker/service_worker_database.h
+++ b/content/browser/service_worker/service_worker_database.h
@@ -64,6 +64,9 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
bool has_fetch_handler;
base::Time last_update_check;
+ // Not populated until ServiceWorkerStorage::StoreRegistration is called.
+ uint64 resources_total_size_bytes;
+
RegistrationData();
~RegistrationData();
};
@@ -71,9 +74,13 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
struct ResourceRecord {
int64 resource_id;
GURL url;
+ // Signed so we can store -1 to specify an unknown or error state. When
+ // stored to the database, this value should always be >= 0.
+ int64 size_bytes;
- ResourceRecord() {}
- ResourceRecord(int64 id, GURL url) : resource_id(id), url(url) {}
+ ResourceRecord() : resource_id(-1), size_bytes(0) {}
+ ResourceRecord(int64 id, GURL url, int64 size_bytes)
+ : resource_id(id), url(url), size_bytes(size_bytes) {}
};
// Reads next available ids from the database. Returns OK if they are

Powered by Google App Engine
This is Rietveld 408576698