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

Side by Side Diff: sync/engine/get_commit_ids_command.h

Issue 10038041: sync: Loop committing items without downloading updates (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 SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ 5 #ifndef SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_
6 #define SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ 6 #define SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "sync/engine/syncer_command.h" 13 #include "sync/engine/syncer_command.h"
14 #include "sync/engine/syncer_util.h" 14 #include "sync/engine/syncer_util.h"
15 #include "sync/sessions/ordered_commit_set.h" 15 #include "sync/sessions/ordered_commit_set.h"
16 #include "sync/sessions/sync_session.h" 16 #include "sync/sessions/sync_session.h"
17 17
18 using std::pair; 18 using std::pair;
19 using std::vector; 19 using std::vector;
20 20
21 namespace browser_sync { 21 namespace browser_sync {
22 22
23 class GetCommitIdsCommand : public SyncerCommand { 23 class GetCommitIdsCommand : public SyncerCommand {
24 friend class SyncerTest; 24 friend class SyncerTest;
25 25
26 public: 26 public:
27 explicit GetCommitIdsCommand(int commit_batch_size); 27 GetCommitIdsCommand(size_t commit_batch_size,
28 sessions::OrderedCommitSet* ordered_commit_set);
28 virtual ~GetCommitIdsCommand(); 29 virtual ~GetCommitIdsCommand();
29 30
30 // SyncerCommand implementation. 31 // SyncerCommand implementation.
31 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; 32 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE;
32 33
33 // Builds a vector of IDs that should be committed. 34 // Builds a vector of IDs that should be committed.
34 void BuildCommitIds(syncable::WriteTransaction* write_transaction, 35 void BuildCommitIds(syncable::WriteTransaction* write_transaction,
35 const ModelSafeRoutingInfo& routes, 36 const ModelSafeRoutingInfo& routes,
36 const std::set<int64>& ready_unsynced_set); 37 const std::set<int64>& ready_unsynced_set);
37 38
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Return values: 87 // Return values:
87 // False: if there was an entry in conflict. 88 // False: if there was an entry in conflict.
88 // True: if all entries were checked for commit readiness and added to 89 // True: if all entries were checked for commit readiness and added to
89 // |result| as necessary. 90 // |result| as necessary.
90 bool AddItemThenPredecessors(syncable::BaseTransaction* trans, 91 bool AddItemThenPredecessors(syncable::BaseTransaction* trans,
91 const std::set<int64>& ready_unsynced_set, 92 const std::set<int64>& ready_unsynced_set,
92 const syncable::Entry& item, 93 const syncable::Entry& item,
93 sessions::OrderedCommitSet* result) const; 94 sessions::OrderedCommitSet* result) const;
94 95
95 // Appends all commit ready predecessors of |item|, followed by |item| itself, 96 // Appends all commit ready predecessors of |item|, followed by |item| itself,
96 // to |ordered_commit_set_|, iff item and all its predecessors not in 97 // to |commit_set|, iff item and all its predecessors not in conflict.
97 // conflict.
98 // Return values: 98 // Return values:
99 // False: if there was an entry in conflict. 99 // False: if there was an entry in conflict.
100 // True: if all entries were checked for commit readiness and added to 100 // True: if all entries were checked for commit readiness and added to
101 // |result| as necessary. 101 // |result| as necessary.
102 bool AddPredecessorsThenItem(syncable::BaseTransaction* trans, 102 bool AddPredecessorsThenItem(syncable::BaseTransaction* trans,
103 const ModelSafeRoutingInfo& routes, 103 const ModelSafeRoutingInfo& routes,
104 const std::set<int64>& ready_unsynced_set, 104 const std::set<int64>& ready_unsynced_set,
105 const syncable::Entry& item, 105 const syncable::Entry& item,
106 sessions::OrderedCommitSet* result) const; 106 sessions::OrderedCommitSet* commit_set) const;
107 107
108 bool IsCommitBatchFull() const; 108 bool IsCommitBatchFull() const;
109 109
110 void AddCreatesAndMoves(syncable::WriteTransaction* write_transaction, 110 void AddCreatesAndMoves(syncable::WriteTransaction* write_transaction,
111 const ModelSafeRoutingInfo& routes, 111 const ModelSafeRoutingInfo& routes,
112 const std::set<int64>& ready_unsynced_set); 112 const std::set<int64>& ready_unsynced_set);
113 113
114 void AddDeletes(syncable::WriteTransaction* write_transaction, 114 void AddDeletes(syncable::WriteTransaction* write_transaction,
115 const std::set<int64>& ready_unsynced_set); 115 const std::set<int64>& ready_unsynced_set);
116 116
117 scoped_ptr<sessions::OrderedCommitSet> ordered_commit_set_; 117 size_t requested_commit_batch_size_;
118 118 sessions::OrderedCommitSet *commit_set_;
119 int requested_commit_batch_size_;
120 119
121 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); 120 DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand);
122 }; 121 };
123 122
124 } // namespace browser_sync 123 } // namespace browser_sync
125 124
126 #endif // SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_ 125 #endif // SYNC_ENGINE_GET_COMMIT_IDS_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698