| 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/syncapi.h" | 5 #include "chrome/browser/sync/engine/syncapi.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 // the server, but we'll get them on a subsequent sync. | 1393 // the server, but we'll get them on a subsequent sync. |
| 1394 // | 1394 // |
| 1395 // Notifications are sent at the end of every sync cycle, regardless of | 1395 // Notifications are sent at the end of every sync cycle, regardless of |
| 1396 // whether we should sync again. | 1396 // whether we should sync again. |
| 1397 if (event.what_happened == SyncerEvent::SYNC_CYCLE_ENDED) { | 1397 if (event.what_happened == SyncerEvent::SYNC_CYCLE_ENDED) { |
| 1398 if (!event.last_session->HasMoreToSync()) { | 1398 if (!event.last_session->HasMoreToSync()) { |
| 1399 observer_->OnSyncCycleCompleted(); | 1399 observer_->OnSyncCycleCompleted(); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 // TODO(chron): Consider changing this back to track HasMoreToSync | 1402 // TODO(chron): Consider changing this back to track HasMoreToSync |
| 1403 // Only notify peers if a commit has occurred and change the bookmark model. | 1403 // Only notify peers if a successful commit has occurred. |
| 1404 if (event.last_session && event.last_session->items_committed()) { | 1404 if (event.last_session && event.last_session->HadSuccessfulCommits()) { |
| 1405 // We use a member variable here because talk may not have connected yet. |
| 1406 // The notification must be stored until it can be sent. |
| 1405 notification_pending_ = true; | 1407 notification_pending_ = true; |
| 1406 } | 1408 } |
| 1407 | 1409 |
| 1408 // SyncCycles are started by the following events: creation of the syncer, | 1410 // SyncCycles are started by the following events: creation of the syncer, |
| 1409 // (re)connection to buzz, local changes, peer notifications of updates. | 1411 // (re)connection to buzz, local changes, peer notifications of updates. |
| 1410 // Peers will be notified of changes made while there is no buzz connection | 1412 // Peers will be notified of changes made while there is no buzz connection |
| 1411 // immediately after a connection has been re-established. | 1413 // immediately after a connection has been re-established. |
| 1412 // the next sync cycle. | 1414 // the next sync cycle. |
| 1413 // TODO(brg): Move this to TalkMediatorImpl as a SyncerThread event hook. | 1415 // TODO(brg): Move this to TalkMediatorImpl as a SyncerThread event hook. |
| 1414 if (notification_pending_ && talk_mediator()) { | 1416 if (notification_pending_ && talk_mediator()) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 BaseTransaction::~BaseTransaction() { | 1565 BaseTransaction::~BaseTransaction() { |
| 1564 delete lookup_; | 1566 delete lookup_; |
| 1565 } | 1567 } |
| 1566 | 1568 |
| 1567 UserShare* SyncManager::GetUserShare() const { | 1569 UserShare* SyncManager::GetUserShare() const { |
| 1568 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1570 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
| 1569 return data_->GetUserShare(); | 1571 return data_->GetUserShare(); |
| 1570 } | 1572 } |
| 1571 | 1573 |
| 1572 } // namespace sync_api | 1574 } // namespace sync_api |
| OLD | NEW |