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

Side by Side Diff: chrome/browser/sync/engine/syncapi.h

Issue 7033043: [Sync] Speed up sync node browser/search in about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file defines the "sync API", an interface to the syncer 5 // This file defines the "sync API", an interface to the syncer
6 // backend that exposes (1) the core functionality of maintaining a consistent 6 // backend that exposes (1) the core functionality of maintaining a consistent
7 // local snapshot of a hierarchical object set; (2) a means to transactionally 7 // local snapshot of a hierarchical object set; (2) a means to transactionally
8 // access and modify those objects; (3) a means to control client/server 8 // access and modify those objects; (3) a means to control client/server
9 // synchronization tasks, namely: pushing local object modifications to a 9 // synchronization tasks, namely: pushing local object modifications to a
10 // server, pulling nonlocal object modifications from a server to this client, 10 // server, pulling nonlocal object modifications from a server to this client,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 virtual int64 GetSuccessorId() const; 268 virtual int64 GetSuccessorId() const;
269 269
270 // Return the ID of the first child of this node. If this node has no 270 // Return the ID of the first child of this node. If this node has no
271 // children, return 0. 271 // children, return 0.
272 virtual int64 GetFirstChildId() const; 272 virtual int64 GetFirstChildId() const;
273 273
274 // These virtual accessors provide access to data members of derived classes. 274 // These virtual accessors provide access to data members of derived classes.
275 virtual const syncable::Entry* GetEntry() const = 0; 275 virtual const syncable::Entry* GetEntry() const = 0;
276 virtual const BaseTransaction* GetTransaction() const = 0; 276 virtual const BaseTransaction* GetTransaction() const = 0;
277 277
278 // Dumps all node info into a DictionaryValue and returns it. 278 // Dumps a summary of node info into a DictionaryValue and returns it.
279 // Transfers ownership of the DictionaryValue to the caller. 279 // Transfers ownership of the DictionaryValue to the caller.
280 DictionaryValue* ToValue() const; 280 DictionaryValue* GetSummaryAsValue() const;
281 281
282 // Does a case in-sensitive search for a given string, which must be 282 // Dumps all node details into a DictionaryValue and returns it.
283 // lower case. 283 // Transfers ownership of the DictionaryValue to the caller.
284 bool ContainsString(const std::string& lowercase_query) const; 284 DictionaryValue* GetDetailsAsValue() const;
285 285
286 protected: 286 protected:
287 BaseNode(); 287 BaseNode();
288 virtual ~BaseNode(); 288 virtual ~BaseNode();
289 // The server has a size limit on client tags, so we generate a fixed length 289 // The server has a size limit on client tags, so we generate a fixed length
290 // hash locally. This also ensures that ModelTypes have unique namespaces. 290 // hash locally. This also ensures that ModelTypes have unique namespaces.
291 static std::string GenerateSyncableHash(syncable::ModelType model_type, 291 static std::string GenerateSyncableHash(syncable::ModelType model_type,
292 const std::string& client_tag); 292 const std::string& client_tag);
293 293
294 // Determines whether part of the entry is encrypted, and if so attempts to 294 // Determines whether part of the entry is encrypted, and if so attempts to
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 // NOTE: It is OK (in fact, it's probably a good idea) to call this before 964 // NOTE: It is OK (in fact, it's probably a good idea) to call this before
965 // having received OnInitializationCompleted. 965 // having received OnInitializationCompleted.
966 void AddObserver(Observer* observer); 966 void AddObserver(Observer* observer);
967 967
968 // Remove the given observer. Make sure to call this if the 968 // Remove the given observer. Make sure to call this if the
969 // Observer is being destroyed so the SyncManager doesn't 969 // Observer is being destroyed so the SyncManager doesn't
970 // potentially dereference garbage. 970 // potentially dereference garbage.
971 void RemoveObserver(Observer* observer); 971 void RemoveObserver(Observer* observer);
972 972
973 // Returns a pointer to the JsBackend (which is owned by the sync 973 // Returns a pointer to the JsBackend (which is owned by the sync
974 // manager). Never returns NULL. The following events are sent by 974 // manager). Never returns NULL. jsDocs for raised events are below:
975 // the returned backend: 975
976 /**
977 * @param {{ enabled: boolean }} details enabled is set to whether
978 * or not notifications are enabled.
979 */
980 // function onNotificationStateChange(details);
981
982 /**
983 * @param {{ changedTypes: Array.<string> }} details changedTypes is
984 * a list of types (as strings) for which there are new updates.
985 */
986 // function onIncomingNotification(details);
987
988 // jsDocs for handled messages are below (all other messages are
989 // ignored).
990
991 /**
992 * Gets the current notification state.
993 *
994 * @param {function(boolean)} callback Called with whether or not
995 * notifications are enabled.
996 */
997 // function getNotificationState(callback);
998
999 /**
1000 * Gets details about the root node.
1001 *
1002 * @param {function(!Object)} callback Called with details about the
1003 * root node.
1004 */
1005 // TODO(akalin): Change this to getRootNodeId or eliminate it
1006 // entirely.
976 // 1007 //
977 // onNotificationStateChange({ enabled: (boolean) }): 1008 // function getRootNodeDetails(callback);
978 // Sent when notifications are enabled or disabled. 1009
979 // 1010 /**
980 // onIncomingNotification({ changedTypes: (array) }): 1011 * Gets summary information for a list of ids.
981 // Sent when an incoming notification arrives. |changedTypes| 1012 *
982 // is a list of sync types (strings) which have changed. 1013 * @param {Array.<string>} idList List of 64-bit ids in decimal
983 // 1014 * string form.
984 // The following messages are processed by the returned backend: 1015 * @param {Array.<{id: string, title: string, isFolder: boolean}>}
985 // 1016 * callback Called with summaries for the nodes in idList that
986 // getNotificationState(): 1017 * exist.
987 // callback(boolean notificationsEnabled): 1018 */
988 // notificationsEnabled: whether or not notifications are 1019 // function getNodeSummariesById(idList, callback);
989 // enabled. 1020
990 // 1021 /**
991 // getRootNode(): 1022 * Gets detailed information for a list of ids.
992 // callback(dictionary nodeInfo): 1023 *
993 // nodeInfo: Information on the root node. 1024 * @param {Array.<string>} idList List of 64-bit ids in decimal
994 // 1025 * string form.
995 // getNodesById(array idList): 1026 * @param {Array.<!Object>} callback Called with detailed
996 // idList: A list of IDs as strings. 1027 * information for the nodes in idList that exist.
997 // callback(array nodeList): 1028 */
998 // nodeList: Information on each node for each valid id in 1029 // function getNodeDetailsById(idList, callback);
999 // idList. Not guaranteed to be in any order. 1030
1000 // 1031 /**
1001 // getChildNodeIds(string id): 1032 * Gets child ids for a given id.
1002 // id: The id of the node for which to return the child node ids. 1033 *
1003 // callback(array idList): 1034 * @param {string} id 64-bit id in decimal string form of the parent
1004 // idList: The child node IDs of the node with the given id. 1035 * node.
1005 // 1036 * @param {Array.<string>} callback Called with the (possibly empty)
1006 // All other messages are dropped. 1037 * list of child ids.
1038 */
1039 // function getChildNodeIds(id);
1040
1007 browser_sync::JsBackend* GetJsBackend(); 1041 browser_sync::JsBackend* GetJsBackend();
1008 1042
1009 // Status-related getters. Typically GetStatusSummary will suffice, but 1043 // Status-related getters. Typically GetStatusSummary will suffice, but
1010 // GetDetailedSyncStatus can be useful for gathering debug-level details of 1044 // GetDetailedSyncStatus can be useful for gathering debug-level details of
1011 // the internals of the sync engine. 1045 // the internals of the sync engine.
1012 Status::Summary GetStatusSummary() const; 1046 Status::Summary GetStatusSummary() const;
1013 Status GetDetailedStatus() const; 1047 Status GetDetailedStatus() const;
1014 1048
1015 // Whether or not the Nigori node is encrypted using an explicit passphrase. 1049 // Whether or not the Nigori node is encrypted using an explicit passphrase.
1016 bool IsUsingExplicitPassphrase(); 1050 bool IsUsingExplicitPassphrase();
(...skipping 29 matching lines...) Expand all
1046 private: 1080 private:
1047 // An opaque pointer to the nested private class. 1081 // An opaque pointer to the nested private class.
1048 SyncInternal* data_; 1082 SyncInternal* data_;
1049 1083
1050 DISALLOW_COPY_AND_ASSIGN(SyncManager); 1084 DISALLOW_COPY_AND_ASSIGN(SyncManager);
1051 }; 1085 };
1052 1086
1053 } // namespace sync_api 1087 } // namespace sync_api
1054 1088
1055 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ 1089 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698