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

Side by Side Diff: sync/engine/build_commit_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_BUILD_COMMIT_COMMAND_H_ 5 #ifndef SYNC_ENGINE_BUILD_COMMIT_COMMAND_H_
6 #define SYNC_ENGINE_BUILD_COMMIT_COMMAND_H_ 6 #define SYNC_ENGINE_BUILD_COMMIT_COMMAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "sync/engine/syncer_command.h" 11 #include "sync/engine/syncer_command.h"
12 #include "sync/engine/syncproto.h" 12 #include "sync/engine/syncproto.h"
13 #include "sync/syncable/syncable.h" 13 #include "sync/syncable/syncable.h"
14 14
15 namespace browser_sync { 15 namespace browser_sync {
16 16
17 namespace sessions {
18 class OrderedCommitSet;
19 }
20
17 class BuildCommitCommand : public SyncerCommand { 21 class BuildCommitCommand : public SyncerCommand {
18 public: 22 public:
19 BuildCommitCommand(); 23 BuildCommitCommand(const sessions::OrderedCommitSet& batch_commit_set,
24 ClientToServerMessage* commit_message);
20 virtual ~BuildCommitCommand(); 25 virtual ~BuildCommitCommand();
21 26
22 // SyncerCommand implementation. 27 // SyncerCommand implementation.
23 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; 28 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE;
24 29
25 private: 30 private:
26 FRIEND_TEST_ALL_PREFIXES(BuildCommitCommandTest, InterpolatePosition); 31 FRIEND_TEST_ALL_PREFIXES(BuildCommitCommandTest, InterpolatePosition);
27 32
28 // Functions returning constants controlling range of values. 33 // Functions returning constants controlling range of values.
29 static int64 GetFirstPosition(); 34 static int64 GetFirstPosition();
30 static int64 GetLastPosition(); 35 static int64 GetLastPosition();
31 static int64 GetGap(); 36 static int64 GetGap();
32 37
33 void AddExtensionsActivityToMessage(sessions::SyncSession* session, 38 void AddExtensionsActivityToMessage(sessions::SyncSession* session,
34 CommitMessage* message); 39 CommitMessage* message);
35 // Helper for computing position. Find the numeric position value 40 // Helper for computing position. Find the numeric position value
36 // of the closest already-synced entry. |direction| must be one of 41 // of the closest already-synced entry. |direction| must be one of
37 // NEXT_ID or PREV_ID; this parameter controls the search direction. 42 // NEXT_ID or PREV_ID; this parameter controls the search direction.
38 // For an open range (no predecessor or successor), the return 43 // For an open range (no predecessor or successor), the return
39 // value will be kFirstPosition or kLastPosition. 44 // value will be kFirstPosition or kLastPosition.
40 int64 FindAnchorPosition(syncable::IdField direction, 45 int64 FindAnchorPosition(syncable::IdField direction,
41 const syncable::Entry& entry); 46 const syncable::Entry& entry);
42 // Given two values of the type returned by FindAnchorPosition, 47 // Given two values of the type returned by FindAnchorPosition,
43 // compute a third value in between the two ranges. 48 // compute a third value in between the two ranges.
44 int64 InterpolatePosition(int64 lo, int64 hi); 49 int64 InterpolatePosition(int64 lo, int64 hi);
45 50
46 DISALLOW_COPY_AND_ASSIGN(BuildCommitCommand); 51 DISALLOW_COPY_AND_ASSIGN(BuildCommitCommand);
52
53 const sessions::OrderedCommitSet& batch_commit_set_;
54 ClientToServerMessage* commit_message_;
47 }; 55 };
48 56
49 } // namespace browser_sync 57 } // namespace browser_sync
50 58
51 #endif // SYNC_ENGINE_BUILD_COMMIT_COMMAND_H_ 59 #endif // SYNC_ENGINE_BUILD_COMMIT_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698