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

Side by Side Diff: components/sync/core_impl/change_reorder_buffer.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
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 // Defines ChangeReorderBuffer, which can be used to sort a list of item 5 // Defines ChangeReorderBuffer, which can be used to sort a list of item
6 // actions to achieve the ordering constraint required by the SyncObserver 6 // actions to achieve the ordering constraint required by the SyncObserver
7 // interface of the SyncAPI. 7 // interface of the SyncAPI.
8 8
9 #ifndef SYNC_INTERNAL_API_CHANGE_REORDER_BUFFER_H_ 9 #ifndef COMPONENTS_SYNC_CORE_IMPL_CHANGE_REORDER_BUFFER_H_
10 #define SYNC_INTERNAL_API_CHANGE_REORDER_BUFFER_H_ 10 #define COMPONENTS_SYNC_CORE_IMPL_CHANGE_REORDER_BUFFER_H_
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include <map> 14 #include <map>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/linked_ptr.h" 19 #include "base/memory/linked_ptr.h"
20 #include "sync/internal_api/public/change_record.h" 20 #include "components/sync/core/change_record.h"
21 #include "sync/protocol/sync.pb.h" 21 #include "components/sync/protocol/sync.pb.h"
22 22
23 namespace syncer { 23 namespace syncer {
24 24
25 class BaseTransaction; 25 class BaseTransaction;
26 26
27 // ChangeReorderBuffer is a utility type which accepts an unordered set 27 // ChangeReorderBuffer is a utility type which accepts an unordered set
28 // of changes (via its Push methods), and yields an ImmutableChangeRecordList 28 // of changes (via its Push methods), and yields an ImmutableChangeRecordList
29 // (via the GetAllChangesInTreeOrder method) that are in the order that 29 // (via the GetAllChangesInTreeOrder method) that are in the order that
30 // the SyncObserver expects them to be. A buffer is initially empty. 30 // the SyncObserver expects them to be. A buffer is initially empty.
31 // 31 //
(...skipping 26 matching lines...) Expand all
58 // Reset the buffer, forgetting any pushed items, so that it can be used again 58 // Reset the buffer, forgetting any pushed items, so that it can be used again
59 // to reorder a new set of changes. 59 // to reorder a new set of changes.
60 void Clear(); 60 void Clear();
61 61
62 bool IsEmpty() const; 62 bool IsEmpty() const;
63 63
64 // Output a reordered list of changes to |changes| using the items 64 // Output a reordered list of changes to |changes| using the items
65 // that were pushed into the reorder buffer. |sync_trans| is used to 65 // that were pushed into the reorder buffer. |sync_trans| is used to
66 // determine the ordering. Returns true if successful, or false if 66 // determine the ordering. Returns true if successful, or false if
67 // an error was encountered. 67 // an error was encountered.
68 bool GetAllChangesInTreeOrder( 68 bool GetAllChangesInTreeOrder(const BaseTransaction* sync_trans,
69 const BaseTransaction* sync_trans, 69 ImmutableChangeRecordList* changes)
70 ImmutableChangeRecordList* changes) WARN_UNUSED_RESULT; 70 WARN_UNUSED_RESULT;
71 71
72 private: 72 private:
73 class Traversal; 73 class Traversal;
74 typedef std::map<int64_t, ChangeRecord::Action> OperationMap; 74 typedef std::map<int64_t, ChangeRecord::Action> OperationMap;
75 typedef std::map<int64_t, sync_pb::EntitySpecifics> SpecificsMap; 75 typedef std::map<int64_t, sync_pb::EntitySpecifics> SpecificsMap;
76 typedef std::map<int64_t, linked_ptr<ExtraPasswordChangeRecordData>> 76 typedef std::map<int64_t, linked_ptr<ExtraPasswordChangeRecordData>>
77 ExtraDataMap; 77 ExtraDataMap;
78 78
79 // Stores the items that have been pushed into the buffer, and the type of 79 // Stores the items that have been pushed into the buffer, and the type of
80 // operation that was associated with them. 80 // operation that was associated with them.
81 OperationMap operations_; 81 OperationMap operations_;
82 82
83 // Stores entity-specific ChangeRecord data per-ID. 83 // Stores entity-specific ChangeRecord data per-ID.
84 SpecificsMap specifics_; 84 SpecificsMap specifics_;
85 85
86 // Stores type-specific extra data per-ID. 86 // Stores type-specific extra data per-ID.
87 ExtraDataMap extra_data_; 87 ExtraDataMap extra_data_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(ChangeReorderBuffer); 89 DISALLOW_COPY_AND_ASSIGN(ChangeReorderBuffer);
90 }; 90 };
91 91
92 } // namespace syncer 92 } // namespace syncer
93 93
94 #endif // SYNC_INTERNAL_API_CHANGE_REORDER_BUFFER_H_ 94 #endif // COMPONENTS_SYNC_CORE_IMPL_CHANGE_REORDER_BUFFER_H_
OLDNEW
« no previous file with comments | « components/sync/core_impl/attachments/task_queue_unittest.cc ('k') | components/sync/core_impl/change_reorder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698