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

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

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
« no previous file with comments | « components/sync/engine_impl/DEPS ('k') | components/sync/engine_impl/backoff_delay_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/sync/engine_impl/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 "components/sync/base/model_type.h" 10 #include "components/sync/base/model_type.h"
(...skipping 17 matching lines...) Expand all
28 SyncStatus status = status_; 28 SyncStatus status = status_;
29 status.encryption_conflicts = 0; 29 status.encryption_conflicts = 0;
30 status.hierarchy_conflicts = 0; 30 status.hierarchy_conflicts = 0;
31 status.server_conflicts = 0; 31 status.server_conflicts = 0;
32 status.committed_count = 0; 32 status.committed_count = 0;
33 return status; 33 return status;
34 } 34 }
35 35
36 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent& event) const { 36 SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent& event) const {
37 SyncStatus status = CreateBlankStatus(); 37 SyncStatus status = CreateBlankStatus();
38 const sessions::SyncSessionSnapshot& snapshot = event.snapshot; 38 const SyncCycleSnapshot& snapshot = event.snapshot;
39 status.encryption_conflicts = snapshot.num_encryption_conflicts(); 39 status.encryption_conflicts = snapshot.num_encryption_conflicts();
40 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts(); 40 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts();
41 status.server_conflicts = snapshot.num_server_conflicts(); 41 status.server_conflicts = snapshot.num_server_conflicts();
42 status.committed_count = 42 status.committed_count =
43 snapshot.model_neutral_state().num_successful_commits; 43 snapshot.model_neutral_state().num_successful_commits;
44 44
45 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) { 45 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) {
46 status.syncing = true; 46 status.syncing = true;
47 } else if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) { 47 } else if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
48 status.syncing = false; 48 status.syncing = false;
49 } 49 }
50 50
51 status.num_entries_by_type = snapshot.num_entries_by_type(); 51 status.num_entries_by_type = snapshot.num_entries_by_type();
52 status.num_to_delete_entries_by_type = 52 status.num_to_delete_entries_by_type =
53 snapshot.num_to_delete_entries_by_type(); 53 snapshot.num_to_delete_entries_by_type();
54 54
55 // Accumulate update count only once per session to avoid double-counting. 55 // Accumulate update count only once per cycle to avoid double-counting.
56 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) { 56 if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
57 status.updates_received += 57 status.updates_received +=
58 snapshot.model_neutral_state().num_updates_downloaded_total; 58 snapshot.model_neutral_state().num_updates_downloaded_total;
59 status.tombstone_updates_received += 59 status.tombstone_updates_received +=
60 snapshot.model_neutral_state().num_tombstone_updates_downloaded_total; 60 snapshot.model_neutral_state().num_tombstone_updates_downloaded_total;
61 status.reflected_updates_received += 61 status.reflected_updates_received +=
62 snapshot.model_neutral_state().num_reflected_updates_downloaded_total; 62 snapshot.model_neutral_state().num_reflected_updates_downloaded_total;
63 status.num_commits_total += 63 status.num_commits_total +=
64 snapshot.model_neutral_state().num_successful_commits; 64 snapshot.model_neutral_state().num_successful_commits;
65 status.num_local_overwrites_total += 65 status.num_local_overwrites_total +=
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 184 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
185 : allstatus_(allstatus) { 185 : allstatus_(allstatus) {
186 allstatus->mutex_.Acquire(); 186 allstatus->mutex_.Acquire();
187 } 187 }
188 188
189 ScopedStatusLock::~ScopedStatusLock() { 189 ScopedStatusLock::~ScopedStatusLock() {
190 allstatus_->mutex_.Release(); 190 allstatus_->mutex_.Release();
191 } 191 }
192 192
193 } // namespace syncer 193 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/DEPS ('k') | components/sync/engine_impl/backoff_delay_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698