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

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

Issue 10038041: sync: Loop committing items without downloading updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 "chrome/browser/sync/internal_api/all_status.h" 5 #include "chrome/browser/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 12 matching lines...) Expand all
23 } 23 }
24 24
25 AllStatus::~AllStatus() { 25 AllStatus::~AllStatus() {
26 } 26 }
27 27
28 sync_api::SyncManager::Status AllStatus::CreateBlankStatus() const { 28 sync_api::SyncManager::Status AllStatus::CreateBlankStatus() const {
29 // Status is initialized with the previous status value. Variables 29 // Status is initialized with the previous status value. Variables
30 // whose values accumulate (e.g. lifetime counters like updates_received) 30 // whose values accumulate (e.g. lifetime counters like updates_received)
31 // are not to be cleared here. 31 // are not to be cleared here.
32 sync_api::SyncManager::Status status = status_; 32 sync_api::SyncManager::Status status = status_;
33 status.unsynced_count = 0;
34 status.encryption_conflicts = 0; 33 status.encryption_conflicts = 0;
35 status.hierarchy_conflicts = 0; 34 status.hierarchy_conflicts = 0;
36 status.simple_conflicts = 0; 35 status.simple_conflicts = 0;
37 status.server_conflicts = 0; 36 status.server_conflicts = 0;
38 status.committed_count = 0; 37 status.committed_count = 0;
39 status.initial_sync_ended = false; 38 status.initial_sync_ended = false;
40 status.updates_available = 0; 39 status.updates_available = 0;
41 return status; 40 return status;
42 } 41 }
43 42
44 sync_api::SyncManager::Status AllStatus::CalcSyncing( 43 sync_api::SyncManager::Status AllStatus::CalcSyncing(
45 const SyncEngineEvent &event) const { 44 const SyncEngineEvent &event) const {
46 sync_api::SyncManager::Status status = CreateBlankStatus(); 45 sync_api::SyncManager::Status status = CreateBlankStatus();
47 const sessions::SyncSessionSnapshot* snapshot = event.snapshot; 46 const sessions::SyncSessionSnapshot* snapshot = event.snapshot;
48 status.unsynced_count = static_cast<int>(snapshot->unsynced_count);
49 status.encryption_conflicts = snapshot->num_encryption_conflicts; 47 status.encryption_conflicts = snapshot->num_encryption_conflicts;
50 status.hierarchy_conflicts = snapshot->num_hierarchy_conflicts; 48 status.hierarchy_conflicts = snapshot->num_hierarchy_conflicts;
51 status.simple_conflicts = snapshot->num_simple_conflicts; 49 status.simple_conflicts = snapshot->num_simple_conflicts;
52 status.server_conflicts = snapshot->num_server_conflicts; 50 status.server_conflicts = snapshot->num_server_conflicts;
53 status.committed_count = snapshot->syncer_status.num_successful_commits; 51 status.committed_count = snapshot->syncer_status.num_successful_commits;
54 52
55 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) { 53 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) {
56 status.syncing = true; 54 status.syncing = true;
57 } else if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { 55 } else if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
58 status.syncing = false; 56 status.syncing = false;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus) 156 ScopedStatusLock::ScopedStatusLock(AllStatus* allstatus)
159 : allstatus_(allstatus) { 157 : allstatus_(allstatus) {
160 allstatus->mutex_.Acquire(); 158 allstatus->mutex_.Acquire();
161 } 159 }
162 160
163 ScopedStatusLock::~ScopedStatusLock() { 161 ScopedStatusLock::~ScopedStatusLock() {
164 allstatus_->mutex_.Release(); 162 allstatus_->mutex_.Release();
165 } 163 }
166 164
167 } // namespace browser_sync 165 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698