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

Side by Side Diff: components/drive/chromeos/change_list_loader.cc

Issue 2842493004: Add OnceCallback support to PostTaskAndReplyWithResult (Closed)
Patch Set: s/can not/cannot/ Created 3 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
« no previous file with comments | « base/task_runner_util.h ('k') | components/drive/chromeos/directory_loader.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 "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
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
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
OLDNEW
« no previous file with comments | « base/task_runner_util.h ('k') | components/drive/chromeos/directory_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698