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

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

Issue 11418309: Add more debug logging in SyncFileSystem services (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/sync_file_system_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 completion_callback_.Reset(); 85 completion_callback_.Reset();
86 } 86 }
87 87
88 void UpdateTask(const tracked_objects::Location& location, 88 void UpdateTask(const tracked_objects::Location& location,
89 TaskType task_type, 89 TaskType task_type,
90 const std::string& description) { 90 const std::string& description) {
91 location_ = location; 91 location_ = location;
92 task_type_ = task_type; 92 task_type_ = task_type;
93 description_ = description; 93 description_ = description;
94 94
95 DVLOG(1) << "Token updated: " << description_ 95 DVLOG(2) << "Token updated: " << description_
96 << " " << location_.ToString(); 96 << " " << location_.ToString();
97 } 97 }
98 98
99 const tracked_objects::Location& location() const { return location_; } 99 const tracked_objects::Location& location() const { return location_; }
100 TaskType task_type() const { return task_type_; } 100 TaskType task_type() const { return task_type_; }
101 const std::string& description() const { return description_; } 101 const std::string& description() const { return description_; }
102 std::string done_description() const { return description_ + " done"; } 102 std::string done_description() const { return description_ + " done"; }
103 103
104 void set_completion_callback(const base::Closure& callback) { 104 void set_completion_callback(const base::Closure& callback) {
105 completion_callback_ = callback; 105 completion_callback_ = callback;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 360 }
361 361
362 const fileapi::FileSystemURL& url = pending_changes_.begin()->url; 362 const fileapi::FileSystemURL& url = pending_changes_.begin()->url;
363 const GURL& origin = url.origin(); 363 const GURL& origin = url.origin();
364 const FilePath& path = url.path(); 364 const FilePath& path = url.path();
365 DCHECK(ContainsKey(url_to_change_, origin)); 365 DCHECK(ContainsKey(url_to_change_, origin));
366 PathToChange* path_to_change = &url_to_change_[origin]; 366 PathToChange* path_to_change = &url_to_change_[origin];
367 DCHECK(ContainsKey(*path_to_change, path)); 367 DCHECK(ContainsKey(*path_to_change, path));
368 const RemoteChange& remote_change = (*path_to_change)[path]; 368 const RemoteChange& remote_change = (*path_to_change)[path];
369 369
370 DVLOG(1) << "ProcessRemoteChange for " << url.DebugString()
371 << " remote_change:" << remote_change.change.DebugString();
372
370 scoped_ptr<ProcessRemoteChangeParam> param(new ProcessRemoteChangeParam( 373 scoped_ptr<ProcessRemoteChangeParam> param(new ProcessRemoteChangeParam(
371 token.Pass(), processor, remote_change, callback)); 374 token.Pass(), processor, remote_change, callback));
372 processor->PrepareForProcessRemoteChange( 375 processor->PrepareForProcessRemoteChange(
373 remote_change.url, 376 remote_change.url,
374 base::Bind(&DriveFileSyncService::DidPrepareForProcessRemoteChange, 377 base::Bind(&DriveFileSyncService::DidPrepareForProcessRemoteChange,
375 AsWeakPtr(), base::Passed(&param))); 378 AsWeakPtr(), base::Passed(&param)));
376 } 379 }
377 380
378 LocalChangeProcessor* DriveFileSyncService::GetLocalChangeProcessor() { 381 LocalChangeProcessor* DriveFileSyncService::GetLocalChangeProcessor() {
379 return this; 382 return this;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 return token_.Pass(); 583 return token_.Pass();
581 } 584 }
582 585
583 void DriveFileSyncService::NotifyTaskDone(fileapi::SyncStatusCode status, 586 void DriveFileSyncService::NotifyTaskDone(fileapi::SyncStatusCode status,
584 scoped_ptr<TaskToken> token) { 587 scoped_ptr<TaskToken> token) {
585 DCHECK(token); 588 DCHECK(token);
586 last_operation_status_ = status; 589 last_operation_status_ = status;
587 token_ = token.Pass(); 590 token_ = token.Pass();
588 591
589 if (token_->task_type() != TASK_TYPE_NONE) { 592 if (token_->task_type() != TASK_TYPE_NONE) {
590 DVLOG(1) << "NotifyTaskDone: " << token_->description() 593 DVLOG(2) << "NotifyTaskDone: " << token_->description()
591 << ": finished with status=" << status 594 << ": finished with status=" << status
595 << " (" << SyncStatusCodeToString(status) << ")"
592 << " " << token_->location().ToString(); 596 << " " << token_->location().ToString();
593 597
594 RemoteServiceState old_state = state_; 598 RemoteServiceState old_state = state_;
595 UpdateServiceState(); 599 UpdateServiceState();
596 600
597 // Notify remote sync service state if the state has been changed. 601 // Notify remote sync service state if the state has been changed.
598 if (!token_->description().empty() || old_state != state_) { 602 if (!token_->description().empty() || old_state != state_) {
599 FOR_EACH_OBSERVER( 603 FOR_EACH_OBSERVER(
600 Observer, observers_, 604 Observer, observers_,
601 OnRemoteServiceStateUpdated(state_, token_->done_description())); 605 OnRemoteServiceStateUpdated(state_, token_->done_description()));
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 } 1414 }
1411 1415
1412 polling_enabled_ = false; 1416 polling_enabled_ = false;
1413 token->set_completion_callback(base::Bind(&EnablePolling, &polling_enabled_)); 1417 token->set_completion_callback(base::Bind(&EnablePolling, &polling_enabled_));
1414 1418
1415 if (metadata_store_->incremental_sync_origins().empty()) { 1419 if (metadata_store_->incremental_sync_origins().empty()) {
1416 NotifyTaskDone(fileapi::SYNC_STATUS_OK, token.Pass()); 1420 NotifyTaskDone(fileapi::SYNC_STATUS_OK, token.Pass());
1417 return; 1421 return;
1418 } 1422 }
1419 1423
1424 DVLOG(1) << "FetchChangesForIncrementalSync (start_changestamp:"
1425 << (largest_fetched_changestamp_ + 1) << ")";
1426
1420 sync_client_->ListChanges( 1427 sync_client_->ListChanges(
1421 largest_fetched_changestamp_ + 1, 1428 largest_fetched_changestamp_ + 1,
1422 base::Bind(&DriveFileSyncService::DidFetchChangesForIncrementalSync, 1429 base::Bind(&DriveFileSyncService::DidFetchChangesForIncrementalSync,
1423 AsWeakPtr(), base::Passed(&token))); 1430 AsWeakPtr(), base::Passed(&token)));
1424 } 1431 }
1425 1432
1426 void DriveFileSyncService::DidFetchChangesForIncrementalSync( 1433 void DriveFileSyncService::DidFetchChangesForIncrementalSync(
1427 scoped_ptr<TaskToken> token, 1434 scoped_ptr<TaskToken> token,
1428 google_apis::GDataErrorCode error, 1435 google_apis::GDataErrorCode error,
1429 scoped_ptr<google_apis::DocumentFeed> changes) { 1436 scoped_ptr<google_apis::DocumentFeed> changes) {
1430 if (error != google_apis::HTTP_SUCCESS) { 1437 if (error != google_apis::HTTP_SUCCESS) {
1431 NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass()); 1438 NotifyTaskDone(GDataErrorCodeToSyncStatusCodeWrapper(error), token.Pass());
1432 return; 1439 return;
1433 } 1440 }
1434 1441
1435 typedef ScopedVector<google_apis::DocumentEntry>::const_iterator iterator; 1442 typedef ScopedVector<google_apis::DocumentEntry>::const_iterator iterator;
1436 for (iterator itr = changes->entries().begin(); 1443 for (iterator itr = changes->entries().begin();
1437 itr != changes->entries().end(); ++itr) { 1444 itr != changes->entries().end(); ++itr) {
1438 const google_apis::DocumentEntry& entry = **itr; 1445 const google_apis::DocumentEntry& entry = **itr;
1446 DVLOG(3) << " change:" << entry.title();
1439 GURL origin; 1447 GURL origin;
1440 if (!GetOriginForEntry(entry, &origin)) 1448 if (!GetOriginForEntry(entry, &origin))
1441 continue; 1449 continue;
1442 1450
1443 AppendNewRemoteChange(origin, entry, entry.changestamp(), 1451 AppendNewRemoteChange(origin, entry, entry.changestamp(),
1444 REMOTE_SYNC_TYPE_INCREMENTAL); 1452 REMOTE_SYNC_TYPE_INCREMENTAL);
1445 } 1453 }
1446 1454
1447 GURL next_feed; 1455 GURL next_feed;
1448 if (changes->GetNextFeedURL(&next_feed)) { 1456 if (changes->GetNextFeedURL(&next_feed)) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 fileapi::SyncStatusCode 1530 fileapi::SyncStatusCode
1523 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( 1531 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper(
1524 google_apis::GDataErrorCode error) const { 1532 google_apis::GDataErrorCode error) const {
1525 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); 1533 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
1526 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) 1534 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated())
1527 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; 1535 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED;
1528 return status; 1536 return status;
1529 } 1537 }
1530 1538
1531 } // namespace sync_file_system 1539 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/sync_file_system_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698