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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 15657002: Mirror syncfs log to console and WebUI, with LogSeverity support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: expect -> assert fix Created 7 years, 6 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_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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 1469
1470 if (may_have_unfetched_changes_ && 1470 if (may_have_unfetched_changes_ &&
1471 !metadata_store_->incremental_sync_origins().empty()) { 1471 !metadata_store_->incremental_sync_origins().empty()) {
1472 task_manager_->ScheduleTaskIfIdle( 1472 task_manager_->ScheduleTaskIfIdle(
1473 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync, 1473 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync,
1474 AsWeakPtr())); 1474 AsWeakPtr()));
1475 } 1475 }
1476 } 1476 }
1477 1477
1478 void DriveFileSyncService::OnNotificationReceived() { 1478 void DriveFileSyncService::OnNotificationReceived() {
1479 util::Log("Notification received to check for Google Drive updates"); 1479 util::Log(logging::LOG_INFO,
1480 FROM_HERE,
1481 "Notification received to check for Google Drive updates");
1480 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable. 1482 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable.
1481 may_have_unfetched_changes_ = true; 1483 may_have_unfetched_changes_ = true;
1482 MaybeStartFetchChanges(); 1484 MaybeStartFetchChanges();
1483 } 1485 }
1484 1486
1485 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) { 1487 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) {
1486 const char* status = (enabled ? "enabled" : "disabled"); 1488 const char* status = (enabled ? "enabled" : "disabled");
1487 util::Log("XMPP Push notification is %s", status); 1489 util::Log(logging::LOG_INFO,
1490 FROM_HERE,
1491 "XMPP Push notification is %s", status);
1488 } 1492 }
1489 1493
1490 void DriveFileSyncService::MaybeScheduleNextTask() { 1494 void DriveFileSyncService::MaybeScheduleNextTask() {
1491 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) 1495 if (GetCurrentState() == REMOTE_SERVICE_DISABLED)
1492 return; 1496 return;
1493 1497
1494 // Notify observer of the update of |pending_changes_|. 1498 // Notify observer of the update of |pending_changes_|.
1495 FOR_EACH_OBSERVER(Observer, service_observers_, 1499 FOR_EACH_OBSERVER(Observer, service_observers_,
1496 OnRemoteChangeQueueUpdated( 1500 OnRemoteChangeQueueUpdated(
1497 remote_change_handler_.ChangesSize())); 1501 remote_change_handler_.ChangesSize()));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1603
1600 DVLOG(3) << " * change:" << entry.title() 1604 DVLOG(3) << " * change:" << entry.title()
1601 << (entry.deleted() ? " (deleted)" : " ") 1605 << (entry.deleted() ? " (deleted)" : " ")
1602 << "[" << origin.spec() << "]"; 1606 << "[" << origin.spec() << "]";
1603 has_new_changes = AppendRemoteChange( 1607 has_new_changes = AppendRemoteChange(
1604 origin, entry, entry.changestamp(), 1608 origin, entry, entry.changestamp(),
1605 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes; 1609 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes;
1606 } 1610 }
1607 1611
1608 if (reset_sync_root) { 1612 if (reset_sync_root) {
1609 LOG(WARNING) << "Detected unexpected SyncRoot deletion."; 1613 util::Log(logging::LOG_WARNING,
1614 FROM_HERE,
1615 "Detected unexpected SyncRoot deletion.");
1610 metadata_store_->SetSyncRootDirectory(std::string()); 1616 metadata_store_->SetSyncRootDirectory(std::string());
1611 } 1617 }
1612 for (std::set<GURL>::iterator itr = reset_origins.begin(); 1618 for (std::set<GURL>::iterator itr = reset_origins.begin();
1613 itr != reset_origins.end(); ++itr) { 1619 itr != reset_origins.end(); ++itr) {
1614 LOG(WARNING) << "Detected unexpected OriginRoot deletion:" << itr->spec(); 1620 util::Log(logging::LOG_WARNING,
1621 FROM_HERE,
1622 "Detected unexpected OriginRoot deletion: %s",
1623 itr->spec().c_str());
1615 pending_batch_sync_origins_.erase(*itr); 1624 pending_batch_sync_origins_.erase(*itr);
1616 metadata_store_->SetOriginRootDirectory(*itr, std::string()); 1625 metadata_store_->SetOriginRootDirectory(*itr, std::string());
1617 } 1626 }
1618 1627
1619 GURL next_feed; 1628 GURL next_feed;
1620 if (changes->GetNextFeedURL(&next_feed)) 1629 if (changes->GetNextFeedURL(&next_feed))
1621 may_have_unfetched_changes_ = true; 1630 may_have_unfetched_changes_ = true;
1622 1631
1623 if (!changes->entries().empty()) 1632 if (!changes->entries().empty())
1624 largest_fetched_changestamp_ = changes->entries().back()->changestamp(); 1633 largest_fetched_changestamp_ = changes->entries().back()->changestamp();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 metadata_store_->SetOriginRootDirectory(origin, resource_id); 1750 metadata_store_->SetOriginRootDirectory(origin, resource_id);
1742 } 1751 }
1743 callback.Run(status, resource_id); 1752 callback.Run(status, resource_id);
1744 } 1753 }
1745 1754
1746 std::string DriveFileSyncService::sync_root_resource_id() { 1755 std::string DriveFileSyncService::sync_root_resource_id() {
1747 return metadata_store_->sync_root_directory(); 1756 return metadata_store_->sync_root_directory();
1748 } 1757 }
1749 1758
1750 } // namespace sync_file_system 1759 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive/api_util.cc ('k') | chrome/browser/sync_file_system/drive_file_sync_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698