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

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: Created 7 years, 7 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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 1445
1446 if (may_have_unfetched_changes_ && 1446 if (may_have_unfetched_changes_ &&
1447 !metadata_store_->incremental_sync_origins().empty()) { 1447 !metadata_store_->incremental_sync_origins().empty()) {
1448 task_manager_->ScheduleTaskIfIdle( 1448 task_manager_->ScheduleTaskIfIdle(
1449 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync, 1449 base::Bind(&DriveFileSyncService::FetchChangesForIncrementalSync,
1450 AsWeakPtr())); 1450 AsWeakPtr()));
1451 } 1451 }
1452 } 1452 }
1453 1453
1454 void DriveFileSyncService::OnNotificationReceived() { 1454 void DriveFileSyncService::OnNotificationReceived() {
1455 util::Log("Notification received to check for Google Drive updates"); 1455 util::Log(logging::LOG_INFO,
1456 "Notification received to check for Google Drive updates");
1456 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable. 1457 // TODO(calvinlo): Try to eliminate may_have_unfetched_changes_ variable.
1457 may_have_unfetched_changes_ = true; 1458 may_have_unfetched_changes_ = true;
1458 MaybeStartFetchChanges(); 1459 MaybeStartFetchChanges();
1459 } 1460 }
1460 1461
1461 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) { 1462 void DriveFileSyncService::OnPushNotificationEnabled(bool enabled) {
1462 const char* status = (enabled ? "enabled" : "disabled"); 1463 const char* status = (enabled ? "enabled" : "disabled");
1463 util::Log("XMPP Push notification is %s", status); 1464 util::Log(logging::LOG_INFO, "XMPP Push notification is %s", status);
1464 } 1465 }
1465 1466
1466 void DriveFileSyncService::MaybeScheduleNextTask() { 1467 void DriveFileSyncService::MaybeScheduleNextTask() {
1467 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) 1468 if (GetCurrentState() == REMOTE_SERVICE_DISABLED)
1468 return; 1469 return;
1469 1470
1470 // Notify observer of the update of |pending_changes_|. 1471 // Notify observer of the update of |pending_changes_|.
1471 FOR_EACH_OBSERVER(Observer, service_observers_, 1472 FOR_EACH_OBSERVER(Observer, service_observers_,
1472 OnRemoteChangeQueueUpdated( 1473 OnRemoteChangeQueueUpdated(
1473 remote_change_handler_.ChangesSize())); 1474 remote_change_handler_.ChangesSize()));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1576
1576 DVLOG(3) << " * change:" << entry.title() 1577 DVLOG(3) << " * change:" << entry.title()
1577 << (entry.deleted() ? " (deleted)" : " ") 1578 << (entry.deleted() ? " (deleted)" : " ")
1578 << "[" << origin.spec() << "]"; 1579 << "[" << origin.spec() << "]";
1579 has_new_changes = AppendRemoteChange( 1580 has_new_changes = AppendRemoteChange(
1580 origin, entry, entry.changestamp(), 1581 origin, entry, entry.changestamp(),
1581 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes; 1582 RemoteChangeHandler::REMOTE_SYNC_TYPE_INCREMENTAL) || has_new_changes;
1582 } 1583 }
1583 1584
1584 if (reset_sync_root) { 1585 if (reset_sync_root) {
1585 LOG(WARNING) << "Detected unexpected SyncRoot deletion."; 1586 util::Log(logging::LOG_WARNING, "Detected unexpected SyncRoot deletion.");
1586 metadata_store_->SetSyncRootDirectory(std::string()); 1587 metadata_store_->SetSyncRootDirectory(std::string());
1587 } 1588 }
1588 for (std::set<GURL>::iterator itr = reset_origins.begin(); 1589 for (std::set<GURL>::iterator itr = reset_origins.begin();
1589 itr != reset_origins.end(); ++itr) { 1590 itr != reset_origins.end(); ++itr) {
1590 LOG(WARNING) << "Detected unexpected OriginRoot deletion:" << itr->spec(); 1591 util::Log(logging::LOG_WARNING,
1592 std::string("Detected unexpected OriginRoot deletion:").append(
nhiroki 2013/05/22 05:42:40 nit: I'd prefer to use operator+() instead of appe
calvinlo 2013/05/22 08:42:56 I forgot this logging statement is like printf and
1593 itr->spec()));
1591 pending_batch_sync_origins_.erase(*itr); 1594 pending_batch_sync_origins_.erase(*itr);
1592 metadata_store_->SetOriginRootDirectory(*itr, std::string()); 1595 metadata_store_->SetOriginRootDirectory(*itr, std::string());
1593 } 1596 }
1594 1597
1595 GURL next_feed; 1598 GURL next_feed;
1596 if (changes->GetNextFeedURL(&next_feed)) 1599 if (changes->GetNextFeedURL(&next_feed))
1597 may_have_unfetched_changes_ = true; 1600 may_have_unfetched_changes_ = true;
1598 1601
1599 if (!changes->entries().empty()) 1602 if (!changes->entries().empty())
1600 largest_fetched_changestamp_ = changes->entries().back()->changestamp(); 1603 largest_fetched_changestamp_ = changes->entries().back()->changestamp();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 pending_batch_sync_origins_.insert(origin); 1715 pending_batch_sync_origins_.insert(origin);
1713 } 1716 }
1714 callback.Run(status, resource_id); 1717 callback.Run(status, resource_id);
1715 } 1718 }
1716 1719
1717 std::string DriveFileSyncService::sync_root_resource_id() { 1720 std::string DriveFileSyncService::sync_root_resource_id() {
1718 return metadata_store_->sync_root_directory(); 1721 return metadata_store_->sync_root_directory();
1719 } 1722 }
1720 1723
1721 } // namespace sync_file_system 1724 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698