| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/all_status.h" | 5 #include "chrome/browser/sync/engine/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 status_ = CreateBlankStatus(); | 128 status_ = CreateBlankStatus(); |
| 129 } | 129 } |
| 130 status_.authenticated = true; | 130 status_.authenticated = true; |
| 131 } else { | 131 } else { |
| 132 status_.authenticated = false; | 132 status_.authenticated = false; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 AllStatus::Status AllStatus::status() const { | 137 AllStatus::Status AllStatus::status() const { |
| 138 AutoLock lock(mutex_); | 138 base::AutoLock lock(mutex_); |
| 139 return status_; | 139 return status_; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void AllStatus::SetNotificationsEnabled(bool notifications_enabled) { | 142 void AllStatus::SetNotificationsEnabled(bool notifications_enabled) { |
| 143 ScopedStatusLock lock(this); | 143 ScopedStatusLock lock(this); |
| 144 status_.notifications_enabled = notifications_enabled; | 144 status_.notifications_enabled = notifications_enabled; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void AllStatus::IncrementNotificationsSent() { | 147 void AllStatus::IncrementNotificationsSent() { |
| 148 ScopedStatusLock lock(this); | 148 ScopedStatusLock lock(this); |
| 149 ++status_.notifications_sent; | 149 ++status_.notifications_sent; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void AllStatus::IncrementNotificationsReceived() { | 152 void AllStatus::IncrementNotificationsReceived() { |
| 153 ScopedStatusLock lock(this); | 153 ScopedStatusLock lock(this); |
| 154 ++status_.notifications_received; | 154 ++status_.notifications_received; |
| 155 } | 155 } |
| 156 | 156 |
| 157 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) | 157 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) |
| 158 : allstatus_(allstatus) { | 158 : allstatus_(allstatus) { |
| 159 allstatus->mutex_.Acquire(); | 159 allstatus->mutex_.Acquire(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 ScopedStatusLock::~ScopedStatusLock() { | 162 ScopedStatusLock::~ScopedStatusLock() { |
| 163 allstatus_->CalcStatusChanges(); | 163 allstatus_->CalcStatusChanges(); |
| 164 allstatus_->mutex_.Release(); | 164 allstatus_->mutex_.Release(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace browser_sync | 167 } // namespace browser_sync |
| OLD | NEW |