OLD | NEW |
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_file_system/drive_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 | 1446 |
1447 if (may_have_unfetched_changes_ && | 1447 if (may_have_unfetched_changes_ && |
1448 !metadata_store_->incremental_sync_origins().empty()) { | 1448 !metadata_store_->incremental_sync_origins().empty()) { |
1449 task_manager_->ScheduleTaskIfIdle( | 1449 task_manager_->ScheduleTaskIfIdle( |
1450 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync, | 1450 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync, |
1451 AsWeakPtr())); | 1451 AsWeakPtr())); |
1452 } | 1452 } |
1453 } | 1453 } |
1454 | 1454 |
1455 void DriveFileSyncService::OnNotificationReceived() { | 1455 void DriveFileSyncService::OnNotificationReceived() { |
1456 util::Log("Notification received to check for Google Drive updates"); | 1456 SYNCFS_LOG(INFO, "Notification received to check for Google Drive updates"); |
1457 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable. | 1457 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable. |
1458 may_have_unfetched_changes_ = true; | 1458 may_have_unfetched_changes_ = true; |
1459 MaybeStartFetchChanges(); | 1459 MaybeStartFetchChanges(); |
1460 } | 1460 } |
1461 | 1461 |
1462 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) { | 1462 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) { |
1463 const char* status = (enabled ? "enabled" : "disabled"); | 1463 const char* status = (enabled ? "enabled" : "disabled"); |
1464 util::Log("XMPP Push notification is %s", status); | 1464 SYNCFS_LOG(INFO, "XMPP Push notification is %s", status); |
1465 } | 1465 } |
1466 | 1466 |
1467 void DriveFileSyncService::MaybeScheduleNextTask() { | 1467 void DriveFileSyncService::MaybeScheduleNextTask() { |
1468 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) | 1468 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) |
1469 return; | 1469 return; |
1470 | 1470 |
1471 // Notify observer of the update of |pending_changes_|. | 1471 // Notify observer of the update of |pending_changes_|. |
1472 FOR_EACH_OBSERVER(Observer, service_observers_, | 1472 FOR_EACH_OBSERVER(Observer, service_observers_, |
1473 OnRemoteChangeQueueUpdated( | 1473 OnRemoteChangeQueueUpdated( |
1474 remote_change_handler_.ChangesSize())); | 1474 remote_change_handler_.ChangesSize())); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 | 1576 |
1577 DVLOG(3) << " * change:" << entry.title() | 1577 DVLOG(3) << " * change:" << entry.title() |
1578 << (entry.deleted() ? " (deleted)" : " ") | 1578 << (entry.deleted() ? " (deleted)" : " ") |
1579 << "[" << origin.spec() << "]"; | 1579 << "[" << origin.spec() << "]"; |
1580 has_new_changes = AppendRemoteChange( | 1580 has_new_changes = AppendRemoteChange( |
1581 origin, entry, entry.changestamp(), | 1581 origin, entry, entry.changestamp(), |
1582 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes; | 1582 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes; |
1583 } | 1583 } |
1584 | 1584 |
1585 if (reset_sync_root) { | 1585 if (reset_sync_root) { |
1586 LOG(WARNING) << "Detected unexpected SyncRoot deletion."; | 1586 SYNCFS_LOG(WARNING, "Detected unexpected SyncRoot deletion."); |
1587 metadata_store_->SetSyncRootDirectory(std::string()); | 1587 metadata_store_->SetSyncRootDirectory(std::string()); |
1588 } | 1588 } |
1589 for (std::set<GURL>::iterator itr = reset_origins.begin(); | 1589 for (std::set<GURL>::iterator itr = reset_origins.begin(); |
1590 itr != reset_origins.end(); ++itr) { | 1590 itr != reset_origins.end(); ++itr) { |
1591 LOG(WARNING) << "Detected unexpected OriginRoot deletion:" << itr->spec(); | 1591 SYNCFS_LOG(WARNING, |
| 1592 "Detected unexpected OriginRoot deletion: %s", |
| 1593 itr->spec().c_str()); |
1592 pending_batch_sync_origins_.erase(*itr); | 1594 pending_batch_sync_origins_.erase(*itr); |
1593 metadata_store_->SetOriginRootDirectory(*itr, std::string()); | 1595 metadata_store_->SetOriginRootDirectory(*itr, std::string()); |
1594 } | 1596 } |
1595 | 1597 |
1596 GURL next_feed; | 1598 GURL next_feed; |
1597 if (changes->GetNextFeedURL(&next_feed)) | 1599 if (changes->GetNextFeedURL(&next_feed)) |
1598 may_have_unfetched_changes_ = true; | 1600 may_have_unfetched_changes_ = true; |
1599 | 1601 |
1600 if (!changes->entries().empty()) | 1602 if (!changes->entries().empty()) |
1601 largest_fetched_changestamp_ = changes->entries().back()->changestamp(); | 1603 largest_fetched_changestamp_ = changes->entries().back()->changestamp(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 pending_batch_sync_origins_.insert(origin); | 1722 pending_batch_sync_origins_.insert(origin); |
1721 } | 1723 } |
1722 callback.Run(status, resource_id); | 1724 callback.Run(status, resource_id); |
1723 } | 1725 } |
1724 | 1726 |
1725 std::string DriveFileSyncService::sync_root_resource_id() { | 1727 std::string DriveFileSyncService::sync_root_resource_id() { |
1726 return metadata_store_->sync_root_directory(); | 1728 return metadata_store_->sync_root_directory(); |
1727 } | 1729 } |
1728 | 1730 |
1729 } // namespace sync_file_system | 1731 } // namespace sync_file_system |
OLD | NEW |