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

Unified Diff: chrome/browser/extensions/api/storage/storage_api.h

Issue 175853002: Revert of Add a Restore() method to ValueStore and make StorageAPI use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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: chrome/browser/extensions/api/storage/storage_api.h
diff --git a/chrome/browser/extensions/api/storage/storage_api.h b/chrome/browser/extensions/api/storage/storage_api.h
index eb9411f1ed4b7bf42aa5bc15e8db99b9d200add9..a37ae6dbeed241edd5597adb72705aa5e6e36586 100644
--- a/chrome/browser/extensions/api/storage/storage_api.h
+++ b/chrome/browser/extensions/api/storage/storage_api.h
@@ -30,42 +30,23 @@
// may return false to imply failure.
virtual bool RunWithStorage(ValueStore* storage) = 0;
- // Handles the |result| of a read function.
- // - If the result succeeded, this will set |result_| and return.
- // - If |result| failed with a ValueStore::CORRUPTION error, this will call
- // RestoreStorageAndRetry(), and return that result.
- // - If the |result| failed with a different error, this will set |error_|
- // and return.
- bool UseReadResult(ValueStore::ReadResult result, ValueStore* storage);
+ // Sets error_ or result_ depending on the value of a storage ReadResult, and
+ // returns whether the result implies success (i.e. !error).
+ bool UseReadResult(ValueStore::ReadResult result);
- // Handles the |result| of a write function.
- // - If the result succeeded, this will set |result_| and return.
- // - If |result| failed with a ValueStore::CORRUPTION error, this will call
- // RestoreStorageAndRetry(), and return that result.
- // - If the |result| failed with a different error, this will set |error_|
- // and return.
- // This will also send out a change notification, if appropriate.
- bool UseWriteResult(ValueStore::WriteResult result, ValueStore* storage);
+ // Sets error_ depending on the value of a storage WriteResult, sends a
+ // change notification if needed, and returns whether the result implies
+ // success (i.e. !error).
+ bool UseWriteResult(ValueStore::WriteResult result);
private:
// Called via PostTask from RunImpl. Calls RunWithStorage and then
// SendResponse with its success value.
void AsyncRunWithStorage(ValueStore* storage);
- // Called if we encounter a ValueStore error. If the error is due to
- // corruption, tries to restore the ValueStore and re-run the API function.
- // If the storage cannot be restored or was due to some other error, then sets
- // error and returns. This also sets the |tried_restoring_storage_| flag to
- // ensure we don't enter a loop.
- bool HandleError(const ValueStore::Error& error, ValueStore* storage);
-
// The settings namespace the call was for. For example, SYNC if the API
// call was chrome.settings.experimental.sync..., LOCAL if .local, etc.
settings_namespace::Namespace settings_namespace_;
-
- // A flag indicating whether or not we have tried to restore storage. We
- // should only ever try once (per API call) in order to avoid entering a loop.
- bool tried_restoring_storage_;
// Observers, cached so that it's only grabbed from the UI thread.
scoped_refptr<SettingsObserverList> observers_;
« no previous file with comments | « chrome/browser/extensions/api/storage/settings_test_util.cc ('k') | chrome/browser/extensions/api/storage/storage_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698