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

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

Issue 11474036: Remove initial_sync_ended bits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 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) 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 "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"
11 #include "sync/engine/net/server_connection_manager.h" 11 #include "sync/engine/net/server_connection_manager.h"
12 #include "sync/internal_api/public/base/model_type.h" 12 #include "sync/internal_api/public/base/model_type.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 15
16 AllStatus::AllStatus() { 16 AllStatus::AllStatus() {
17 status_.initial_sync_ended = true;
18 status_.notifications_enabled = false; 17 status_.notifications_enabled = false;
19 status_.cryptographer_ready = false; 18 status_.cryptographer_ready = false;
20 status_.crypto_has_pending_keys = false; 19 status_.crypto_has_pending_keys = false;
21 } 20 }
22 21
23 AllStatus::~AllStatus() { 22 AllStatus::~AllStatus() {
24 } 23 }
25 24
26 SyncStatus AllStatus::CreateBlankStatus() const { 25 SyncStatus AllStatus::CreateBlankStatus() const {
27 // Status is initialized with the previous status value. Variables 26 // Status is initialized with the previous status value. Variables
28 // whose values accumulate (e.g. lifetime counters like updates_received) 27 // whose values accumulate (e.g. lifetime counters like updates_received)
29 // are not to be cleared here. 28 // are not to be cleared here.
30 SyncStatus status = status_; 29 SyncStatus status = status_;
31 status.encryption_conflicts = 0; 30 status.encryption_conflicts = 0;
32 status.hierarchy_conflicts = 0; 31 status.hierarchy_conflicts = 0;
33 status.server_conflicts = 0; 32 status.server_conflicts = 0;
34 status.committed_count = 0; 33 status.committed_count = 0;
35 status.initial_sync_ended = false;
36 status.updates_available = 0; 34 status.updates_available = 0;
37 return status; 35 return status;
38 } 36 }
39 37
40 SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const { 38 SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const {
41 SyncStatus status = CreateBlankStatus(); 39 SyncStatus status = CreateBlankStatus();
42 const sessions::SyncSessionSnapshot& snapshot = event.snapshot; 40 const sessions::SyncSessionSnapshot& snapshot = event.snapshot;
43 status.encryption_conflicts = snapshot.num_encryption_conflicts(); 41 status.encryption_conflicts = snapshot.num_encryption_conflicts();
44 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts(); 42 status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts();
45 status.server_conflicts = snapshot.num_server_conflicts(); 43 status.server_conflicts = snapshot.num_server_conflicts();
46 status.committed_count = 44 status.committed_count =
47 snapshot.model_neutral_state().num_successful_commits; 45 snapshot.model_neutral_state().num_successful_commits;
48 46
49 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) { 47 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) {
50 status.syncing = true; 48 status.syncing = true;
51 } else if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { 49 } else if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
52 status.syncing = false; 50 status.syncing = false;
53 } 51 }
54 52
55 status.initial_sync_ended |= snapshot.is_share_usable();
56
57 status.updates_available += snapshot.num_server_changes_remaining(); 53 status.updates_available += snapshot.num_server_changes_remaining();
58 status.sync_protocol_error = 54 status.sync_protocol_error =
59 snapshot.model_neutral_state().sync_protocol_error; 55 snapshot.model_neutral_state().sync_protocol_error;
60 56
61 status.num_entries_by_type = snapshot.num_entries_by_type(); 57 status.num_entries_by_type = snapshot.num_entries_by_type();
62 status.num_to_delete_entries_by_type = 58 status.num_to_delete_entries_by_type =
63 snapshot.num_to_delete_entries_by_type(); 59 snapshot.num_to_delete_entries_by_type();
64 60
65 // Accumulate update count only once per session to avoid double-counting. 61 // Accumulate update count only once per session to avoid double-counting.
66 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { 62 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 192 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
197 : allstatus_(allstatus) { 193 : allstatus_(allstatus) {
198 allstatus->mutex_.Acquire(); 194 allstatus->mutex_.Acquire();
199 } 195 }
200 196
201 ScopedStatusLock::~ScopedStatusLock() { 197 ScopedStatusLock::~ScopedStatusLock() {
202 allstatus_->mutex_.Release(); 198 allstatus_->mutex_.Release();
203 } 199 }
204 200
205 } // namespace syncer 201 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.cc ('k') | sync/engine/apply_control_data_updates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698