| 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/chromeos/change_list_loader.h" | 5 #include "components/drive/chromeos/change_list_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/synchronization/cancellation_flag.h" | 18 #include "base/synchronization/cancellation_flag.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "components/drive/chromeos/change_list_loader_observer.h" | 21 #include "components/drive/chromeos/change_list_loader_observer.h" |
| 22 #include "components/drive/chromeos/change_list_processor.h" | 22 #include "components/drive/chromeos/change_list_processor.h" |
| 23 #include "components/drive/chromeos/resource_metadata.h" | 23 #include "components/drive/chromeos/resource_metadata.h" |
| 24 #include "components/drive/drive_api_util.h" |
| 24 #include "components/drive/event_logger.h" | 25 #include "components/drive/event_logger.h" |
| 25 #include "components/drive/file_system_core_util.h" | 26 #include "components/drive/file_system_core_util.h" |
| 26 #include "components/drive/job_scheduler.h" | 27 #include "components/drive/job_scheduler.h" |
| 27 #include "google_apis/drive/drive_api_parser.h" | 28 #include "google_apis/drive/drive_api_parser.h" |
| 28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 29 | 30 |
| 30 namespace drive { | 31 namespace drive { |
| 31 namespace internal { | 32 namespace internal { |
| 32 | 33 |
| 33 typedef base::Callback<void(FileError, | 34 typedef base::Callback<void(FileError, |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 ChangeListProcessor* change_list_processor = | 570 ChangeListProcessor* change_list_processor = |
| 570 new ChangeListProcessor(resource_metadata_, in_shutdown_.get()); | 571 new ChangeListProcessor(resource_metadata_, in_shutdown_.get()); |
| 571 // Don't send directory content change notification while performing | 572 // Don't send directory content change notification while performing |
| 572 // the initial content retrieval. | 573 // the initial content retrieval. |
| 573 const bool should_notify_changed_directories = is_delta_update; | 574 const bool should_notify_changed_directories = is_delta_update; |
| 574 | 575 |
| 575 logger_->Log(logging::LOG_INFO, | 576 logger_->Log(logging::LOG_INFO, |
| 576 "Apply change lists (is delta: %d)", | 577 "Apply change lists (is delta: %d)", |
| 577 is_delta_update); | 578 is_delta_update); |
| 578 loader_controller_->ScheduleRun(base::Bind( | 579 loader_controller_->ScheduleRun(base::Bind( |
| 579 base::IgnoreResult( | 580 &drive::util::RunAsyncTask, base::RetainedRef(blocking_task_runner_), |
| 580 &base::PostTaskAndReplyWithResult<FileError, FileError>), | 581 FROM_HERE, |
| 581 base::RetainedRef(blocking_task_runner_), FROM_HERE, | |
| 582 base::Bind(&ChangeListProcessor::Apply, | 582 base::Bind(&ChangeListProcessor::Apply, |
| 583 base::Unretained(change_list_processor), | 583 base::Unretained(change_list_processor), |
| 584 base::Passed(&about_resource), base::Passed(&change_lists), | 584 base::Passed(&about_resource), base::Passed(&change_lists), |
| 585 is_delta_update), | 585 is_delta_update), |
| 586 base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterUpdate, | 586 base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterUpdate, |
| 587 weak_ptr_factory_.GetWeakPtr(), | 587 weak_ptr_factory_.GetWeakPtr(), |
| 588 base::Owned(change_list_processor), | 588 base::Owned(change_list_processor), |
| 589 should_notify_changed_directories, base::Time::Now()))); | 589 should_notify_changed_directories, base::Time::Now()))); |
| 590 } | 590 } |
| 591 | 591 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 607 } | 607 } |
| 608 | 608 |
| 609 OnChangeListLoadComplete(error); | 609 OnChangeListLoadComplete(error); |
| 610 | 610 |
| 611 for (auto& observer : observers_) | 611 for (auto& observer : observers_) |
| 612 observer.OnLoadFromServerComplete(); | 612 observer.OnLoadFromServerComplete(); |
| 613 } | 613 } |
| 614 | 614 |
| 615 } // namespace internal | 615 } // namespace internal |
| 616 } // namespace drive | 616 } // namespace drive |
| OLD | NEW |