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

Unified Diff: chrome/browser/sync/internal_api/base_node.h

Issue 10152003: sync: Make BaseNode lookup-related Init functions return specific failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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/sync/internal_api/base_node.h
diff --git a/chrome/browser/sync/internal_api/base_node.h b/chrome/browser/sync/internal_api/base_node.h
index 9aaeaec7be41d98fc9f380f2a44d5903b87a519f..dbf720a71d9d2fbdd8e284ddea9fa1e997b3889b 100644
--- a/chrome/browser/sync/internal_api/base_node.h
+++ b/chrome/browser/sync/internal_api/base_node.h
@@ -56,15 +56,30 @@ static const int64 kInvalidId = 0;
// int64 metahandle, which we call an ID here.
class BaseNode {
public:
+ // Enumerates the possible outcomes of trying to initialize a sync node.
+ enum InitByLookupResult {
+ INIT_OK,
+ // Could not find an entry matching the lookup criteria.
+ INIT_FAILED_ENTRY_NOT_GOOD,
+ // Found an entry, but it is already deleted.
+ INIT_FAILED_ENTRY_IS_DEL,
+ // Found an entry, but was unable to decrypt.
+ INIT_FAILED_DECRYPT_IF_NECESSARY,
+ // A precondition was not met for calling init, such as legal input
+ // arguments.
+ INIT_FAILED_PRECONDITION,
+ };
+
// All subclasses of BaseNode must provide a way to initialize themselves by
// doing an ID lookup. Returns false on failure. An invalid or deleted
// ID will result in failure.
- virtual bool InitByIdLookup(int64 id) = 0;
+ virtual InitByLookupResult InitByIdLookup(int64 id) = 0;
// All subclasses of BaseNode must also provide a way to initialize themselves
// by doing a client tag lookup. Returns false on failure. A deleted node
// will return FALSE.
- virtual bool InitByClientTagLookup(syncable::ModelType model_type,
+ virtual InitByLookupResult InitByClientTagLookup(
+ syncable::ModelType model_type,
const std::string& tag) = 0;
// Each object is identified by a 64-bit id (internally, the syncable
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | chrome/browser/sync/internal_api/change_reorder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698