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

Side by Side Diff: sync/internal_api/all_status.cc

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up and rebased Created 8 years, 6 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 | Annotate | Revision Log
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 #include "sync/internal_api/all_status.h" 5 #include "sync/internal_api/all_status.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/port.h" 10 #include "base/port.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void AllStatus::IncrementNotificationsReceived() { 130 void AllStatus::IncrementNotificationsReceived() {
131 ScopedStatusLock lock(this); 131 ScopedStatusLock lock(this);
132 ++status_.notifications_received; 132 ++status_.notifications_received;
133 } 133 }
134 134
135 void AllStatus::SetEncryptedTypes(syncable::ModelTypeSet types) { 135 void AllStatus::SetEncryptedTypes(syncable::ModelTypeSet types) {
136 ScopedStatusLock lock(this); 136 ScopedStatusLock lock(this);
137 status_.encrypted_types = types; 137 status_.encrypted_types = types;
138 } 138 }
139 139
140 void AllStatus::SetThrottledTypes(syncable::ModelTypeSet types) {
141 ScopedStatusLock lock(this);
142 status_.throttled_types = types;
143 }
144
140 void AllStatus::SetCryptographerReady(bool ready) { 145 void AllStatus::SetCryptographerReady(bool ready) {
141 ScopedStatusLock lock(this); 146 ScopedStatusLock lock(this);
142 status_.cryptographer_ready = ready; 147 status_.cryptographer_ready = ready;
143 } 148 }
144 149
145 void AllStatus::SetCryptoHasPendingKeys(bool has_pending_keys) { 150 void AllStatus::SetCryptoHasPendingKeys(bool has_pending_keys) {
146 ScopedStatusLock lock(this); 151 ScopedStatusLock lock(this);
147 status_.crypto_has_pending_keys = has_pending_keys; 152 status_.crypto_has_pending_keys = has_pending_keys;
148 } 153 }
149 154
150 void AllStatus::SetUniqueId(const std::string& guid) { 155 void AllStatus::SetUniqueId(const std::string& guid) {
151 ScopedStatusLock lock(this); 156 ScopedStatusLock lock(this);
152 status_.unique_id = guid; 157 status_.unique_id = guid;
153 } 158 }
154 159
155 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 160 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
156 : allstatus_(allstatus) { 161 : allstatus_(allstatus) {
157 allstatus->mutex_.Acquire(); 162 allstatus->mutex_.Acquire();
158 } 163 }
159 164
160 ScopedStatusLock::~ScopedStatusLock() { 165 ScopedStatusLock::~ScopedStatusLock() {
161 allstatus_->mutex_.Release(); 166 allstatus_->mutex_.Release();
162 } 167 }
163 168
164 } // namespace browser_sync 169 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698