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

Side by Side Diff: components/sync/engine_impl/worker_entity_tracker.cc

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 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 "components/sync/engine_impl/worker_entity_tracker.h" 5 #include "components/sync/engine_impl/worker_entity_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "components/sync/base/model_type.h" 10 #include "components/sync/base/model_type.h"
11 #include "components/sync/base/time.h" 11 #include "components/sync/base/time.h"
12 #include "components/sync/syncable/syncable_util.h" 12 #include "components/sync/syncable/syncable_util.h"
13 13
14 namespace syncer { 14 namespace syncer_v2 {
15 15
16 WorkerEntityTracker::WorkerEntityTracker(const std::string& client_tag_hash) 16 WorkerEntityTracker::WorkerEntityTracker(const std::string& client_tag_hash)
17 : client_tag_hash_(client_tag_hash) { 17 : client_tag_hash_(client_tag_hash) {
18 DCHECK(!client_tag_hash_.empty()); 18 DCHECK(!client_tag_hash_.empty());
19 } 19 }
20 20
21 WorkerEntityTracker::~WorkerEntityTracker() {} 21 WorkerEntityTracker::~WorkerEntityTracker() {}
22 22
23 bool WorkerEntityTracker::HasPendingCommit() const { 23 bool WorkerEntityTracker::HasPendingCommit() const {
24 return !!pending_commit_; 24 return !!pending_commit_;
(...skipping 13 matching lines...) Expand all
38 commit_entity->set_client_defined_unique_tag(client_tag_hash_); 38 commit_entity->set_client_defined_unique_tag(client_tag_hash_);
39 commit_entity->set_version(base_version_); 39 commit_entity->set_version(base_version_);
40 commit_entity->set_deleted(entity.is_deleted()); 40 commit_entity->set_deleted(entity.is_deleted());
41 41
42 // TODO(stanisc): This doesn't support bookmarks yet. 42 // TODO(stanisc): This doesn't support bookmarks yet.
43 DCHECK(entity.parent_id.empty()); 43 DCHECK(entity.parent_id.empty());
44 commit_entity->set_folder(false); 44 commit_entity->set_folder(false);
45 45
46 commit_entity->set_name(entity.non_unique_name); 46 commit_entity->set_name(entity.non_unique_name);
47 if (!entity.is_deleted()) { 47 if (!entity.is_deleted()) {
48 commit_entity->set_ctime(TimeToProtoTime(entity.creation_time)); 48 commit_entity->set_ctime(syncer::TimeToProtoTime(entity.creation_time));
49 commit_entity->set_mtime(TimeToProtoTime(entity.modification_time)); 49 commit_entity->set_mtime(syncer::TimeToProtoTime(entity.modification_time));
50 commit_entity->mutable_specifics()->CopyFrom(entity.specifics); 50 commit_entity->mutable_specifics()->CopyFrom(entity.specifics);
51 } 51 }
52 } 52 }
53 53
54 void WorkerEntityTracker::RequestCommit(const CommitRequestData& data) { 54 void WorkerEntityTracker::RequestCommit(const CommitRequestData& data) {
55 DCHECK_GE(data.base_version, base_version_) 55 DCHECK_GE(data.base_version, base_version_)
56 << "Base version should never decrease"; 56 << "Base version should never decrease";
57 DCHECK_GE(data.sequence_number, sequence_number_) 57 DCHECK_GE(data.sequence_number, sequence_number_)
58 << "Sequence number should never decrease"; 58 << "Sequence number should never decrease";
59 59
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 bool WorkerEntityTracker::IsServerKnown() const { 193 bool WorkerEntityTracker::IsServerKnown() const {
194 return base_version_ != kUncommittedVersion; 194 return base_version_ != kUncommittedVersion;
195 } 195 }
196 196
197 void WorkerEntityTracker::ClearPendingCommit() { 197 void WorkerEntityTracker::ClearPendingCommit() {
198 pending_commit_.reset(); 198 pending_commit_.reset();
199 pending_commit_specifics_hash_.clear(); 199 pending_commit_specifics_hash_.clear();
200 } 200 }
201 201
202 } // namespace syncer 202 } // namespace syncer_v2
OLDNEW
« no previous file with comments | « components/sync/engine_impl/worker_entity_tracker.h ('k') | components/sync/engine_impl/worker_entity_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698