| 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 "components/drive/change_list_loader.h" | 5 #include "components/drive/change_list_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // Don't send directory content change notification while performing | 537 // Don't send directory content change notification while performing |
| 538 // the initial content retrieval. | 538 // the initial content retrieval. |
| 539 const bool should_notify_changed_directories = is_delta_update; | 539 const bool should_notify_changed_directories = is_delta_update; |
| 540 | 540 |
| 541 logger_->Log(logging::LOG_INFO, | 541 logger_->Log(logging::LOG_INFO, |
| 542 "Apply change lists (is delta: %d)", | 542 "Apply change lists (is delta: %d)", |
| 543 is_delta_update); | 543 is_delta_update); |
| 544 loader_controller_->ScheduleRun(base::Bind( | 544 loader_controller_->ScheduleRun(base::Bind( |
| 545 base::IgnoreResult( | 545 base::IgnoreResult( |
| 546 &base::PostTaskAndReplyWithResult<FileError, FileError>), | 546 &base::PostTaskAndReplyWithResult<FileError, FileError>), |
| 547 blocking_task_runner_, | 547 base::RetainedRef(blocking_task_runner_), FROM_HERE, |
| 548 FROM_HERE, | |
| 549 base::Bind(&ChangeListProcessor::Apply, | 548 base::Bind(&ChangeListProcessor::Apply, |
| 550 base::Unretained(change_list_processor), | 549 base::Unretained(change_list_processor), |
| 551 base::Passed(&about_resource), | 550 base::Passed(&about_resource), base::Passed(&change_lists), |
| 552 base::Passed(&change_lists), | |
| 553 is_delta_update), | 551 is_delta_update), |
| 554 base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterUpdate, | 552 base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterUpdate, |
| 555 weak_ptr_factory_.GetWeakPtr(), | 553 weak_ptr_factory_.GetWeakPtr(), |
| 556 base::Owned(change_list_processor), | 554 base::Owned(change_list_processor), |
| 557 should_notify_changed_directories, | 555 should_notify_changed_directories, base::Time::Now()))); |
| 558 base::Time::Now()))); | |
| 559 } | 556 } |
| 560 | 557 |
| 561 void ChangeListLoader::LoadChangeListFromServerAfterUpdate( | 558 void ChangeListLoader::LoadChangeListFromServerAfterUpdate( |
| 562 ChangeListProcessor* change_list_processor, | 559 ChangeListProcessor* change_list_processor, |
| 563 bool should_notify_changed_directories, | 560 bool should_notify_changed_directories, |
| 564 const base::Time& start_time, | 561 const base::Time& start_time, |
| 565 FileError error) { | 562 FileError error) { |
| 566 DCHECK(thread_checker_.CalledOnValidThread()); | 563 DCHECK(thread_checker_.CalledOnValidThread()); |
| 567 | 564 |
| 568 const base::TimeDelta elapsed = base::Time::Now() - start_time; | 565 const base::TimeDelta elapsed = base::Time::Now() - start_time; |
| 569 logger_->Log(logging::LOG_INFO, | 566 logger_->Log(logging::LOG_INFO, |
| 570 "Change lists applied (elapsed time: %sms)", | 567 "Change lists applied (elapsed time: %sms)", |
| 571 base::Int64ToString(elapsed.InMilliseconds()).c_str()); | 568 base::Int64ToString(elapsed.InMilliseconds()).c_str()); |
| 572 | 569 |
| 573 if (should_notify_changed_directories) { | 570 if (should_notify_changed_directories) { |
| 574 FOR_EACH_OBSERVER(ChangeListLoaderObserver, | 571 FOR_EACH_OBSERVER(ChangeListLoaderObserver, |
| 575 observers_, | 572 observers_, |
| 576 OnFileChanged(change_list_processor->changed_files())); | 573 OnFileChanged(change_list_processor->changed_files())); |
| 577 } | 574 } |
| 578 | 575 |
| 579 OnChangeListLoadComplete(error); | 576 OnChangeListLoadComplete(error); |
| 580 | 577 |
| 581 FOR_EACH_OBSERVER(ChangeListLoaderObserver, | 578 FOR_EACH_OBSERVER(ChangeListLoaderObserver, |
| 582 observers_, | 579 observers_, |
| 583 OnLoadFromServerComplete()); | 580 OnLoadFromServerComplete()); |
| 584 } | 581 } |
| 585 | 582 |
| 586 } // namespace internal | 583 } // namespace internal |
| 587 } // namespace drive | 584 } // namespace drive |
| OLD | NEW |