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

Side by Side Diff: chrome/browser/sync/glue/bookmark_model_associator.h

Issue 9978017: [Sync] - Upload the callstacks for errors so that the line number of error is in callstack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // AssociatorInterface implementation. 52 // AssociatorInterface implementation.
53 // 53 //
54 // AssociateModels iterates through both the sync and the browser 54 // AssociateModels iterates through both the sync and the browser
55 // bookmark model, looking for matched pairs of items. For any pairs it 55 // bookmark model, looking for matched pairs of items. For any pairs it
56 // finds, it will call AssociateSyncID. For any unmatched items, 56 // finds, it will call AssociateSyncID. For any unmatched items,
57 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new 57 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new
58 // node. After successful completion, the models should be identical and 58 // node. After successful completion, the models should be identical and
59 // corresponding. Returns true on success. On failure of this step, we 59 // corresponding. Returns true on success. On failure of this step, we
60 // should abort the sync operation and report an error to the user. 60 // should abort the sync operation and report an error to the user.
61 virtual bool AssociateModels(SyncError* error) OVERRIDE; 61 virtual SyncError AssociateModels() OVERRIDE;
62 62
63 virtual bool DisassociateModels(SyncError* error) OVERRIDE; 63 virtual SyncError DisassociateModels() OVERRIDE;
64 64
65 // The has_nodes out param is true if the sync model has nodes other 65 // The has_nodes out param is true if the sync model has nodes other
66 // than the permanent tagged nodes. 66 // than the permanent tagged nodes.
67 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; 67 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE;
68 68
69 // Returns sync id for the given bookmark node id. 69 // Returns sync id for the given bookmark node id.
70 // Returns sync_api::kInvalidId if the sync node is not found for the given 70 // Returns sync_api::kInvalidId if the sync node is not found for the given
71 // bookmark node id. 71 // bookmark node id.
72 virtual int64 GetSyncIdFromChromeId(const int64& node_id) OVERRIDE; 72 virtual int64 GetSyncIdFromChromeId(const int64& node_id) OVERRIDE;
73 73
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Persists all dirty associations. 110 // Persists all dirty associations.
111 void PersistAssociations(); 111 void PersistAssociations();
112 112
113 // Loads the persisted associations into in-memory maps. 113 // Loads the persisted associations into in-memory maps.
114 // If the persisted associations are out-of-date due to some reason, returns 114 // If the persisted associations are out-of-date due to some reason, returns
115 // false; otherwise returns true. 115 // false; otherwise returns true.
116 bool LoadAssociations(); 116 bool LoadAssociations();
117 117
118 // Matches up the bookmark model and the sync model to build model 118 // Matches up the bookmark model and the sync model to build model
119 // associations. 119 // associations.
120 bool BuildAssociations(SyncError* error); 120 SyncError BuildAssociations();
121 121
122 // Associate a top-level node of the bookmark model with a permanent node in 122 // Associate a top-level node of the bookmark model with a permanent node in
123 // the sync domain. Such permanent nodes are identified by a tag that is 123 // the sync domain. Such permanent nodes are identified by a tag that is
124 // well known to the server and the client, and is unique within a particular 124 // well known to the server and the client, and is unique within a particular
125 // user's share. For example, "other_bookmarks" is the tag for the Other 125 // user's share. For example, "other_bookmarks" is the tag for the Other
126 // Bookmarks folder. The sync nodes are server-created. 126 // Bookmarks folder. The sync nodes are server-created.
127 bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, 127 SyncError AssociateTaggedPermanentNode(
128 const std::string& tag) WARN_UNUSED_RESULT; 128 const BookmarkNode* permanent_node,
129 const std::string& tag) WARN_UNUSED_RESULT;
129 130
130 // Compare the properties of a pair of nodes from either domain. 131 // Compare the properties of a pair of nodes from either domain.
131 bool NodesMatch(const BookmarkNode* bookmark, 132 bool NodesMatch(const BookmarkNode* bookmark,
132 const sync_api::BaseNode* sync_node) const; 133 const sync_api::BaseNode* sync_node) const;
133 134
134 BookmarkModel* bookmark_model_; 135 BookmarkModel* bookmark_model_;
135 sync_api::UserShare* user_share_; 136 sync_api::UserShare* user_share_;
136 DataTypeErrorHandler* unrecoverable_error_handler_; 137 DataTypeErrorHandler* unrecoverable_error_handler_;
137 const bool expect_mobile_bookmarks_folder_; 138 const bool expect_mobile_bookmarks_folder_;
138 BookmarkIdToSyncIdMap id_map_; 139 BookmarkIdToSyncIdMap id_map_;
139 SyncIdToBookmarkNodeMap id_map_inverse_; 140 SyncIdToBookmarkNodeMap id_map_inverse_;
140 // Stores sync ids for dirty associations. 141 // Stores sync ids for dirty associations.
141 DirtyAssociationsSyncIds dirty_associations_sync_ids_; 142 DirtyAssociationsSyncIds dirty_associations_sync_ids_;
142 143
143 // Used to post PersistAssociation tasks to the current message loop and 144 // Used to post PersistAssociation tasks to the current message loop and
144 // guarantees no invocations can occur if |this| has been deleted. (This 145 // guarantees no invocations can occur if |this| has been deleted. (This
145 // allows this class to be non-refcounted). 146 // allows this class to be non-refcounted).
146 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; 147 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_;
147 148
148 int number_of_new_sync_nodes_created_at_association_; 149 int number_of_new_sync_nodes_created_at_association_;
149 150
150 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 151 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
151 }; 152 };
152 153
153 } // namespace browser_sync 154 } // namespace browser_sync
154 155
155 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 156 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698