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

Side by Side Diff: content/browser/service_worker/service_worker_database.h

Issue 1152543002: ServiceWorker: Migrate the script cache backend from BlockFile to Simple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: support the case that the old diskcache exists but the database does not Created 5 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 // 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 <string> 10 #include <string>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 }; 85 };
86 86
87 // Reads next available ids from the database. Returns OK if they are 87 // Reads next available ids from the database. Returns OK if they are
88 // successfully read. Fills the arguments with an initial value and returns 88 // successfully read. Fills the arguments with an initial value and returns
89 // OK if they are not found in the database. Otherwise, returns an error. 89 // OK if they are not found in the database. Otherwise, returns an error.
90 Status GetNextAvailableIds( 90 Status GetNextAvailableIds(
91 int64* next_avail_registration_id, 91 int64* next_avail_registration_id,
92 int64* next_avail_version_id, 92 int64* next_avail_version_id,
93 int64* next_avail_resource_id); 93 int64* next_avail_resource_id);
94 94
95 // Used for diskcache migration (http://crbug.com/487482). Returns true if the
96 // storage needs to migrate a disk cache.
97 Status IsDiskCacheMigrationNeeded(bool* migration_needed);
98 Status SetDiskCacheMigrationNotNeeded();
99
100 // Used for diskcache migration (http://crbug.com/487482). Returns true if the
101 // storage needs to delete an old disk cache.
102 Status IsOldDiskCacheDeletionNeeded(bool* deletion_needed);
103 Status SetOldDiskCacheDeletionNotNeeded();
104
95 // Reads origins that have one or more than one registration from the 105 // Reads origins that have one or more than one registration from the
96 // database. Returns OK if they are successfully read or not found. 106 // database. Returns OK if they are successfully read or not found.
97 // Otherwise, returns an error. 107 // Otherwise, returns an error.
98 Status GetOriginsWithRegistrations(std::set<GURL>* origins); 108 Status GetOriginsWithRegistrations(std::set<GURL>* origins);
99 109
100 // Reads registrations for |origin| from the database. Returns OK if they are 110 // Reads registrations for |origin| from the database. Returns OK if they are
101 // successfully read or not found. Otherwise, returns an error. 111 // successfully read or not found. Otherwise, returns an error.
102 Status GetRegistrationsForOrigin( 112 Status GetRegistrationsForOrigin(
103 const GURL& origin, 113 const GURL& origin,
104 std::vector<RegistrationData>* registrations, 114 std::vector<RegistrationData>* registrations,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 int64 next_avail_resource_id_; 369 int64 next_avail_resource_id_;
360 int64 next_avail_version_id_; 370 int64 next_avail_version_id_;
361 371
362 enum State { 372 enum State {
363 UNINITIALIZED, 373 UNINITIALIZED,
364 INITIALIZED, 374 INITIALIZED,
365 DISABLED, 375 DISABLED,
366 }; 376 };
367 State state_; 377 State state_;
368 378
379 #if defined(UNIT_TEST)
nhiroki 2015/06/17 02:17:55 Hmmm... only win_chromium_compile_dbg_ng fails to
nhiroki 2015/06/17 05:41:06 This setter needs to be inlined, but the dbg-bot d
380 void set_skip_writing_diskcache_migration_state_on_init_for_testing() {
381 skip_writing_diskcache_migration_state_on_init_for_testing_ = true;
382 }
383 #endif
384 bool skip_writing_diskcache_migration_state_on_init_for_testing_;
385
369 base::SequenceChecker sequence_checker_; 386 base::SequenceChecker sequence_checker_;
370 387
371 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase); 388 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase);
372 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase_InMemory); 389 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, OpenDatabase_InMemory);
373 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion); 390 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DatabaseVersion);
374 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds); 391 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, GetNextAvailableIds);
375 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, 392 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
376 Registration_UninitializedDatabase); 393 Registration_UninitializedDatabase);
377 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, 394 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest,
378 UserData_UninitializedDatabase); 395 UserData_UninitializedDatabase);
379 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase); 396 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DestroyDatabase);
397 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, DiskCacheMigrationState);
380 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, UpgradeSchemaToVersion2); 398 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDatabaseTest, UpgradeSchemaToVersion2);
399 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest,
400 MigrateOnDiskCacheAccess);
401 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDiskCacheMigratorTest,
402 NotMigrateOnDatabaseAccess);
381 403
382 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase); 404 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDatabase);
383 }; 405 };
384 406
385 } // namespace content 407 } // namespace content
386 408
387 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_ 409 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DATABASE_H_
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_disk_cache.cc ('k') | content/browser/service_worker/service_worker_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698