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

Side by Side Diff: sync/internal_api/public/data_batch_impl.h

Issue 1648813002: [Sync] Renaming client key to client tag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_
6 #define SYNC_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "sync/api/data_batch.h" 16 #include "sync/api/data_batch.h"
17 #include "sync/api/entity_data.h" 17 #include "sync/api/entity_data.h"
18 18
19 namespace syncer_v2 { 19 namespace syncer_v2 {
20 20
21 // An implementation of DataBatch that's purpose is to transfer ownership of 21 // An implementation of DataBatch that's purpose is to transfer ownership of
22 // EntityData objects. As soon as this batch recieves the EntityData, it owns 22 // EntityData objects. As soon as this batch recieves the EntityData, it owns
23 // them until Next() is invoked, when it gives up ownerhsip. Because a vector 23 // them until Next() is invoked, when it gives up ownerhsip. Because a vector
24 // is used internally, this impl is unaware when duplcate client_keys are used, 24 // is used internally, this impl is unaware when duplcate client_tags are used,
25 // and it is the caller's job to avoid this. 25 // and it is the caller's job to avoid this.
26 class SYNC_EXPORT DataBatchImpl : public DataBatch { 26 class SYNC_EXPORT DataBatchImpl : public DataBatch {
27 public: 27 public:
28 DataBatchImpl(); 28 DataBatchImpl();
29 ~DataBatchImpl() override; 29 ~DataBatchImpl() override;
30 30
31 // Takes ownership of the data tied to a given key used for storage. Put 31 // Takes ownership of the data tied to a given tag used for storage. Put
32 // should be called at most once for any given client_key. Data will be 32 // should be called at most once for any given client_tag. Data will be
33 // readable in the same order that they are put into the batch. 33 // readable in the same order that they are put into the batch.
34 void Put(const std::string& client_key, scoped_ptr<EntityData> entity_data); 34 void Put(const std::string& client_tag, scoped_ptr<EntityData> entity_data);
35 35
36 // DataBatch implementation. 36 // DataBatch implementation.
37 bool HasNext() const override; 37 bool HasNext() const override;
38 KeyAndData Next() override; 38 TagAndData Next() override;
39 39
40 private: 40 private:
41 std::vector<KeyAndData> key_data_pairs_; 41 std::vector<TagAndData> tag_data_pairs_;
42 size_t read_index_ = 0; 42 size_t read_index_ = 0;
43 43
44 DISALLOW_COPY_AND_ASSIGN(DataBatchImpl); 44 DISALLOW_COPY_AND_ASSIGN(DataBatchImpl);
45 }; 45 };
46 46
47 } // namespace syncer_v2 47 } // namespace syncer_v2
48 48
49 #endif // SYNC_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_ 49 #endif // SYNC_INTERNAL_API_PUBLIC_DATA_BATCH_IMPL_H_
OLDNEW
« no previous file with comments | « sync/internal_api/model_type_entity_unittest.cc ('k') | sync/internal_api/public/data_batch_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698