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

Unified Diff: chrome/browser/sync/engine/syncapi.h

Issue 4683003: Sending the proto files for review to unblcok the server team Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/sync/engine/read_node_mock.h ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncapi.h
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index 9a3da9b3e5ebd0861f16a746f821960ac78a01ab..cbaa670827d90d30d132bc43a5bae6706c755300 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -81,6 +81,7 @@ class WriteTransaction;
namespace sync_pb {
class AppSpecifics;
class AutofillSpecifics;
+class AutofillProfile2Specifics;
class BookmarkSpecifics;
class EntitySpecifics;
class ExtensionSpecifics;
@@ -127,6 +128,9 @@ struct SyncCredentials {
// A valid BaseNode will never have an ID of zero.
static const int64 kInvalidId = 0;
+// Alias this to fit in the 80 character width.
+using sync_pb::AutofillProfile2Specifics;
+
// BaseNode wraps syncable::Entry, and corresponds to a single object's state.
// This, like syncable::Entry, is intended for use on the stack. A valid
// transaction is necessary to create a BaseNode or any of its children.
@@ -149,7 +153,7 @@ class BaseNode {
// metahandle). These ids are strictly local handles. They will persist
// on this client, but the same object on a different client may have a
// different ID value.
- int64 GetId() const;
+ virtual int64 GetId() const;
// Nodes are hierarchically arranged into a single-rooted tree.
// InitByRootLookup on ReadNode allows access to the root. GetParentId is
@@ -195,6 +199,8 @@ class BaseNode {
// data. Can only be called if GetModelType() == AUTOFILL.
const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const;
+ virtual const AutofillProfile2Specifics& GetAutofillProfileSpecifics() const;
+
// Getter specific to the NIGORI datatype. Returns protobuf
// data. Can only be called if GetModelType() == NIGORI.
const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const;
@@ -232,11 +238,11 @@ class BaseNode {
// Return the ID of the node immediately after this in the sibling order.
// For the last node in the ordering, return 0.
- int64 GetSuccessorId() const;
+ virtual int64 GetSuccessorId() const;
// Return the ID of the first child of this node. If this node has no
// children, return 0.
- int64 GetFirstChildId() const;
+ virtual int64 GetFirstChildId() const;
// These virtual accessors provide access to data members of derived classes.
virtual const syncable::Entry* GetEntry() const = 0;
@@ -245,6 +251,14 @@ class BaseNode {
protected:
BaseNode();
virtual ~BaseNode();
+
+ // BaseNode object is used to read nodes continuously
+ // from the db. In case of items like autofill entries
+ // Potentially there could be thousands of entries. Instead
+ // of deleting and recreating the entry each time make sure
+ // provide a way to reset it.
+ void Reset();
+
// The server has a size limit on client tags, so we generate a fixed length
// hash locally. This also ensures that ModelTypes have unique namespaces.
static std::string GenerateSyncableHash(syncable::ModelType model_type,
@@ -256,9 +270,6 @@ class BaseNode {
bool DecryptIfNecessary(syncable::Entry* entry);
private:
- // Node is meant for stack use only.
- void* operator new(size_t size);
-
// If this node represents a password, this field will hold the actual
// decrypted password data.
scoped_ptr<sync_pb::PasswordSpecificsData> password_data_;
@@ -436,6 +447,13 @@ class ReadNode : public BaseNode {
explicit ReadNode(const BaseTransaction* transaction);
virtual ~ReadNode();
+ // ReadNode object is used to read nodes continuously
+ // from the db. In case of items like autofill entries
+ // Potentially there could be thousands of entries. Instead
+ // of deleting and recreating the entry each time make sure
+ // provide a way to reset it.
+ void Reset();
+
// A client must use one (and only one) of the following Init variants to
// populate the node.
@@ -457,9 +475,10 @@ class ReadNode : public BaseNode {
virtual const syncable::Entry* GetEntry() const;
virtual const BaseTransaction* GetTransaction() const;
- private:
- void* operator new(size_t size); // Node is meant for stack use only.
+ protected:
+ ReadNode();
+ private:
// The underlying syncable object which this class wraps.
syncable::Entry* entry_;
@@ -492,6 +511,10 @@ class BaseTransaction {
explicit BaseTransaction(UserShare* share);
virtual ~BaseTransaction();
+ // For unit testing purpose. The entire class would be mocked.
+ // So there is not point initializing anything here.
+ BaseTransaction();
+
private:
// A syncable ScopedDirLookup, which is the parent of syncable transactions.
syncable::ScopedDirLookup* lookup_;
@@ -537,12 +560,16 @@ class WriteTransaction : public BaseTransaction {
virtual syncable::BaseTransaction* GetWrappedTrans() const;
syncable::WriteTransaction* GetWrappedWriteTrans() { return transaction_; }
- private:
- void* operator new(size_t size); // Transaction is meant for stack use only.
+protected:
+ // Empty constructor for unit tests
+ WriteTransaction() {}
// The underlying syncable object which this class wraps.
syncable::WriteTransaction* transaction_;
+ private:
+ void* operator new(size_t size); // Transaction is meant for stack use only.
+
DISALLOW_COPY_AND_ASSIGN(WriteTransaction);
};
« no previous file with comments | « chrome/browser/sync/engine/read_node_mock.h ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698