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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // Versions are first stored once they successfully install and become 57 // Versions are first stored once they successfully install and become
58 // the waiting version. Then transition to the active version. The stored 58 // the waiting version. Then transition to the active version. The stored
59 // version may be in the ACTIVATED state or in the INSTALLED state. 59 // version may be in the ACTIVATED state or in the INSTALLED state.
60 GURL script; 60 GURL script;
61 int64 version_id; 61 int64 version_id;
62 bool is_active; 62 bool is_active;
63 bool has_fetch_handler; 63 bool has_fetch_handler;
64 base::Time last_update_check; 64 base::Time last_update_check;
65 65
66 // Not populated until ServiceWorkerStorage::StoreRegistration is called.
67 uint64 resources_total_size_bytes;
68
66 RegistrationData(); 69 RegistrationData();
67 ~RegistrationData(); 70 ~RegistrationData();
68 }; 71 };
69 72
70 struct ResourceRecord { 73 struct ResourceRecord {
71 int64 resource_id; 74 int64 resource_id;
72 GURL url; 75 GURL url;
76 // Signed so we can store -1 to specify an unknown or error state. When
77 // stored to the database, this value should always be >= 0.
78 int64 size_bytes;
73 79
74 ResourceRecord() {} 80 ResourceRecord() {}
75 ResourceRecord(int64 id, GURL url) : resource_id(id), url(url) {} 81 ResourceRecord(int64 id, GURL url, int64 size_bytes)
82 : resource_id(id), url(url), size_bytes(size_bytes) {}
76 }; 83 };
77 84
78 // Reads next available ids from the database. Returns OK if they are 85 // Reads next available ids from the database. Returns OK if they are
79 // successfully read. Fills the arguments with an initial value and returns 86 // successfully read. Fills the arguments with an initial value and returns
80 // OK if they are not found in the database. Otherwise, returns an error. 87 // OK if they are not found in the database. Otherwise, returns an error.
81 Status GetNextAvailableIds( 88 Status GetNextAvailableIds(
82 int64* next_avail_registration_id, 89 int64* next_avail_registration_id,
83 int64* next_avail_version_id, 90 int64* next_avail_version_id,
84 int64* next_avail_resource_id); 91 int64* next_avail_resource_id);
85 92
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); 331 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion);
325 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); 332 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds);
326 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); 333 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase);
327 334
328 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); 335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase);
329 }; 336 };
330 337
331 } // namespace content 338 } // namespace content
332 339
333 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 340 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698