Chromium Code Reviews| Index: chrome/browser/value_store/value_store.h |
| diff --git a/chrome/browser/value_store/value_store.h b/chrome/browser/value_store/value_store.h |
| index 2b203ea57b779297a647e991b0825b64e64de9ae..650d69c656c2f1c0fc21ce006c670a37f89b1db5 100644 |
| --- a/chrome/browser/value_store/value_store.h |
| +++ b/chrome/browser/value_store/value_store.h |
| @@ -77,6 +77,10 @@ class ValueStore { |
| bool HasError() const { return error_; } |
| + bool IsCorruption() const { |
|
Matt Perry
2014/02/19 01:34:22
opt: HasCorruption or IsCorrupted would sound bett
Devlin
2014/02/19 17:43:19
I've no preference, but I think Ben originally sug
Devlin
2014/02/19 17:48:52
Done.
|
| + return error_.get() && error_->code == CORRUPTION; |
| + } |
| + |
| // Gets the settings read from the storage. Note that this represents |
| // the root object. If you request the value for key "foo", that value will |
| // be in |settings|.|foo|. |
| @@ -191,6 +195,27 @@ class ValueStore { |
| // Clears the storage. |
| virtual WriteResult Clear() = 0; |
| + |
| + // In the event of corruption, the ValueStore should be able to restore |
| + // itself. This means deleting local corrupted files. If only a few keys are |
| + // corrupted, then some of the database may be saved. If the full database is |
| + // corrupted, this will erase it in its entirety. |
| + // Returns true on success, false on failure. The only way this will fail is |
| + // if we also cannot delete the database file. |
| + // Note: This method needs to read (and possibly delete) the whole database, |
| + // so it is slow and should be used sparingly. |
| + // Note: This method (and the following RestoreKey()) are rude, and do not |
| + // make any logs, track changes, or other generally polite things. Please do |
| + // not use these as substitutes for Clear() and Remove(). |
| + virtual bool Restore() = 0; |
| + |
| + // Similar to Restore(), but for only a particular key. If the key is corrupt, |
| + // this will forcefully remove the key. It does not look at the database on |
| + // the whole, which makes it faster, but does not guarantee there is no |
| + // additional corruption. |
| + // Returns true on success, and false on failure. If false, the next step is |
| + // probably to Restore() the whole database. |
| + virtual bool RestoreKey(const std::string& key) = 0; |
| }; |
| #endif // CHROME_BROWSER_VALUE_STORE_VALUE_STORE_H_ |