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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 (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/engine/all_status.h" 5 #include "components/sync/engine_impl/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 "sync/engine/net/server_connection_manager.h" 10 #include "components/sync/base/model_type.h"
11 #include "sync/engine/sync_cycle_event.h" 11 #include "components/sync/engine_impl/net/server_connection_manager.h"
12 #include "sync/internal_api/public/base/model_type.h" 12 #include "components/sync/engine_impl/sync_cycle_event.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 15
16 AllStatus::AllStatus() { 16 AllStatus::AllStatus() {
17 status_.notifications_enabled = false; 17 status_.notifications_enabled = false;
18 status_.cryptographer_ready = false; 18 status_.cryptographer_ready = false;
19 status_.crypto_has_pending_keys = false; 19 status_.crypto_has_pending_keys = false;
20 } 20 }
21 21
22 AllStatus::~AllStatus() { 22 AllStatus::~AllStatus() {}
23 }
24 23
25 SyncStatus AllStatus::CreateBlankStatus() const { 24 SyncStatus AllStatus::CreateBlankStatus() const {
26 // Status is initialized with the previous status value. Variables 25 // Status is initialized with the previous status value. Variables
27 // whose values accumulate (e.g. lifetime counters like updates_received) 26 // whose values accumulate (e.g. lifetime counters like updates_received)
28 // are not to be cleared here. 27 // are not to be cleared here.
29 SyncStatus status = status_; 28 SyncStatus status = status_;
30 status.encryption_conflicts = 0; 29 status.encryption_conflicts = 0;
31 status.hierarchy_conflicts = 0; 30 status.hierarchy_conflicts = 0;
32 status.server_conflicts = 0; 31 status.server_conflicts = 0;
33 status.committed_count = 0; 32 status.committed_count = 0;
34 return status; 33 return status;
35 } 34 }
36 35
37 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent &event) const { 36 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent& event) const {
38 SyncStatus status = CreateBlankStatus(); 37 SyncStatus status = CreateBlankStatus();
39 const sessions::SyncSessionSnapshot& snapshot = event.snapshot; 38 const sessions::SyncSessionSnapshot& snapshot = event.snapshot;
40 status.encryption_conflicts = snapshot.num_encryption_conflicts(); 39 status.encryption_conflicts = snapshot.num_encryption_conflicts();
41 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts(); 40 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts();
42 status.server_conflicts = snapshot.num_server_conflicts(); 41 status.server_conflicts = snapshot.num_server_conflicts();
43 status.committed_count = 42 status.committed_count =
44 snapshot.model_neutral_state().num_successful_commits; 43 snapshot.model_neutral_state().num_successful_commits;
45 44
46 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) { 45 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) {
47 status.syncing = true; 46 status.syncing = true;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 184 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
186 : allstatus_(allstatus) { 185 : allstatus_(allstatus) {
187 allstatus->mutex_.Acquire(); 186 allstatus->mutex_.Acquire();
188 } 187 }
189 188
190 ScopedStatusLock::~ScopedStatusLock() { 189 ScopedStatusLock::~ScopedStatusLock() {
191 allstatus_->mutex_.Release(); 190 allstatus_->mutex_.Release();
192 } 191 }
193 192
194 } // namespace syncer 193 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/all_status.h ('k') | components/sync/engine_impl/apply_control_data_updates.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698