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

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

Issue 11533008: Use delete journal to remove bookmarks that are already deleted in sync model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/sync/glue/data_type_controller.h" 15 #include "chrome/browser/sync/glue/data_type_controller.h"
16 #include "chrome/browser/sync/glue/data_type_error_handler.h" 16 #include "chrome/browser/sync/glue/data_type_error_handler.h"
17 #include "chrome/browser/sync/glue/model_associator.h" 17 #include "chrome/browser/sync/glue/model_associator.h"
18 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 18 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
19 19
20 class BookmarkModel; 20 class BookmarkModel;
21 class BookmarkNode; 21 class BookmarkNode;
22 22
23 namespace syncer { 23 namespace syncer {
24 class BaseNode; 24 class BaseNode;
25 class BaseTransaction;
25 struct UserShare; 26 struct UserShare;
26 } 27 }
27 28
28 namespace browser_sync { 29 namespace browser_sync {
29 30
30 // Contains all model association related logic: 31 // Contains all model association related logic:
31 // * Algorithm to associate bookmark model and sync model. 32 // * Algorithm to associate bookmark model and sync model.
32 // * Methods to get a bookmark node for a given sync node and vice versa. 33 // * Methods to get a bookmark node for a given sync node and vice versa.
33 // * Persisting model associations and loading them back. 34 // * Persisting model associations and loading them back.
34 class BookmarkModelAssociator 35 class BookmarkModelAssociator
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void PostPersistAssociationsTask(); 112 void PostPersistAssociationsTask();
112 // Persists all dirty associations. 113 // Persists all dirty associations.
113 void PersistAssociations(); 114 void PersistAssociations();
114 115
115 // Matches up the bookmark model and the sync model to build model 116 // Matches up the bookmark model and the sync model to build model
116 // associations. 117 // associations.
117 syncer::SyncError BuildAssociations( 118 syncer::SyncError BuildAssociations(
118 syncer::SyncMergeResult* local_merge_result, 119 syncer::SyncMergeResult* local_merge_result,
119 syncer::SyncMergeResult* syncer_merge_result); 120 syncer::SyncMergeResult* syncer_merge_result);
120 121
122 // Removes bookmark nodes whose corresponding sync nodes have been deleted
123 // according to sync delete journals. Return number of such bookmarks nodes
124 // found.
125 int64 ApplyDeletesFromSyncJournal(syncer::BaseTransaction* trans);
126
121 // Associate a top-level node of the bookmark model with a permanent node in 127 // Associate a top-level node of the bookmark model with a permanent node in
122 // the sync domain. Such permanent nodes are identified by a tag that is 128 // the sync domain. Such permanent nodes are identified by a tag that is
123 // well known to the server and the client, and is unique within a particular 129 // well known to the server and the client, and is unique within a particular
124 // user's share. For example, "other_bookmarks" is the tag for the Other 130 // user's share. For example, "other_bookmarks" is the tag for the Other
125 // Bookmarks folder. The sync nodes are server-created. 131 // Bookmarks folder. The sync nodes are server-created.
126 // Returns true on success, false if association failed. 132 // Returns true on success, false if association failed.
127 bool AssociateTaggedPermanentNode( 133 bool AssociateTaggedPermanentNode(
128 const BookmarkNode* permanent_node, 134 const BookmarkNode* permanent_node,
129 const std::string& tag) WARN_UNUSED_RESULT; 135 const std::string& tag) WARN_UNUSED_RESULT;
130 136
(...skipping 18 matching lines...) Expand all
149 // guarantees no invocations can occur if |this| has been deleted. (This 155 // guarantees no invocations can occur if |this| has been deleted. (This
150 // allows this class to be non-refcounted). 156 // allows this class to be non-refcounted).
151 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; 157 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_;
152 158
153 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 159 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
154 }; 160 };
155 161
156 } // namespace browser_sync 162 } // namespace browser_sync
157 163
158 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 164 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698