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

Side by Side Diff: chrome/browser/sync/engine/update_applicator.cc

Issue 8637006: [Sync] Make syncer commands avoid posting tasks on threads with no work to do (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head, fix windows compile Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/update_applicator.h" 5 #include "chrome/browser/sync/engine/update_applicator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/sync/engine/syncer_util.h" 10 #include "chrome/browser/sync/engine/syncer_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 void UpdateApplicator::Advance() { 92 void UpdateApplicator::Advance() {
93 --end_; 93 --end_;
94 *pointer_ = *end_; 94 *pointer_ = *end_;
95 } 95 }
96 96
97 bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) { 97 bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) {
98 syncable::ModelType type = entry.GetServerModelType(); 98 syncable::ModelType type = entry.GetServerModelType();
99 ModelSafeGroup g = GetGroupForModelType(type, routing_info_); 99 ModelSafeGroup g = GetGroupForModelType(type, routing_info_);
100 // The extra routing_info count check here is to support GetUpdateses for 100 // The set of updates passed to the UpdateApplicator should already
101 // a subset of the globally enabled types, and not attempt to update items 101 // be group-filtered.
102 // if their type isn't permitted in the current run. These would typically 102 if (g != group_filter_) {
103 // be unapplied items from a previous sync. 103 NOTREACHED();
104 if (g != group_filter_)
105 return true; 104 return true;
105 }
106 if (g == GROUP_PASSIVE && 106 if (g == GROUP_PASSIVE &&
107 !routing_info_.count(type) && 107 !routing_info_.count(type) &&
108 type != syncable::UNSPECIFIED && 108 type != syncable::UNSPECIFIED &&
109 type != syncable::TOP_LEVEL_FOLDER) { 109 type != syncable::TOP_LEVEL_FOLDER) {
110 DVLOG(1) << "Skipping update application, type not permitted."; 110 DVLOG(1) << "Skipping update application, type not permitted.";
111 return true; 111 return true;
112 } 112 }
113 return false; 113 return false;
114 } 114 }
115 115
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void UpdateApplicator::ResultTracker::ClearConflicts() { 170 void UpdateApplicator::ResultTracker::ClearConflicts() {
171 conflicting_ids_.clear(); 171 conflicting_ids_.clear();
172 encryption_conflict_ids_.clear(); 172 encryption_conflict_ids_.clear();
173 } 173 }
174 174
175 bool UpdateApplicator::ResultTracker::no_conflicts() const { 175 bool UpdateApplicator::ResultTracker::no_conflicts() const {
176 return conflicting_ids_.empty(); 176 return conflicting_ids_.empty();
177 } 177 }
178 178
179 } // namespace browser_sync 179 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/sync/engine/verify_updates_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698