OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "sync/engine/entity_tracker.h" | 5 #include "sync/engine/entity_tracker.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "sync/internal_api/public/base/model_type.h" | 8 #include "sync/internal_api/public/base/model_type.h" |
9 #include "sync/internal_api/public/non_blocking_sync_common.h" | 9 #include "sync/internal_api/public/non_blocking_sync_common.h" |
10 #include "sync/syncable/syncable_util.h" | 10 #include "sync/syncable/syncable_util.h" |
11 #include "sync/util/time.h" | 11 #include "sync/util/time.h" |
12 | 12 |
13 namespace syncer { | 13 namespace syncer { |
14 | 14 |
15 EntityTracker* EntityTracker::FromServerUpdate( | 15 scoped_ptr<EntityTracker> EntityTracker::FromServerUpdate( |
16 const std::string& id_string, | 16 const std::string& id_string, |
17 const std::string& client_tag_hash, | 17 const std::string& client_tag_hash, |
18 int64 received_version) { | 18 int64 received_version) { |
19 return new EntityTracker(id_string, client_tag_hash, 0, received_version); | 19 return make_scoped_ptr( |
| 20 new EntityTracker(id_string, client_tag_hash, 0, received_version)); |
20 } | 21 } |
21 | 22 |
22 EntityTracker* EntityTracker::FromCommitRequest( | 23 scoped_ptr<EntityTracker> EntityTracker::FromCommitRequest( |
23 const std::string& id_string, | 24 const std::string& id_string, |
24 const std::string& client_tag_hash, | 25 const std::string& client_tag_hash, |
25 int64 sequence_number, | 26 int64 sequence_number, |
26 int64 base_version, | 27 int64 base_version, |
27 base::Time ctime, | 28 base::Time ctime, |
28 base::Time mtime, | 29 base::Time mtime, |
29 const std::string& non_unique_name, | 30 const std::string& non_unique_name, |
30 bool deleted, | 31 bool deleted, |
31 const sync_pb::EntitySpecifics& specifics) { | 32 const sync_pb::EntitySpecifics& specifics) { |
32 return new EntityTracker(id_string, | 33 return make_scoped_ptr(new EntityTracker( |
33 client_tag_hash, | 34 id_string, client_tag_hash, 0, 0, true, sequence_number, base_version, |
34 0, | 35 ctime, mtime, non_unique_name, deleted, specifics)); |
35 0, | |
36 true, | |
37 sequence_number, | |
38 base_version, | |
39 ctime, | |
40 mtime, | |
41 non_unique_name, | |
42 deleted, | |
43 specifics); | |
44 } | 36 } |
45 | 37 |
46 // Constructor that does not set any pending commit fields. | 38 // Constructor that does not set any pending commit fields. |
47 EntityTracker::EntityTracker(const std::string& id, | 39 EntityTracker::EntityTracker(const std::string& id, |
48 const std::string& client_tag_hash, | 40 const std::string& client_tag_hash, |
49 int64 highest_commit_response_version, | 41 int64 highest_commit_response_version, |
50 int64 highest_gu_response_version) | 42 int64 highest_gu_response_version) |
51 : id_(id), | 43 : id_(id), |
52 client_tag_hash_(client_tag_hash), | 44 client_tag_hash_(client_tag_hash), |
53 highest_commit_response_version_(highest_commit_response_version), | 45 highest_commit_response_version_(highest_commit_response_version), |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 251 } |
260 | 252 |
261 void EntityTracker::ClearPendingCommit() { | 253 void EntityTracker::ClearPendingCommit() { |
262 is_commit_pending_ = false; | 254 is_commit_pending_ = false; |
263 | 255 |
264 // Clearing the specifics might free up some memory. It can't hurt to try. | 256 // Clearing the specifics might free up some memory. It can't hurt to try. |
265 specifics_.Clear(); | 257 specifics_.Clear(); |
266 } | 258 } |
267 | 259 |
268 } // namespace syncer | 260 } // namespace syncer |
OLD | NEW |