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

Side by Side Diff: components/drive/chromeos/directory_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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/directory_loader.h" 5 #include "components/drive/chromeos/directory_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
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/time/time.h" 18 #include "base/time/time.h"
19 #include "components/drive/chromeos/change_list_loader.h" 19 #include "components/drive/chromeos/change_list_loader.h"
20 #include "components/drive/chromeos/change_list_loader_observer.h" 20 #include "components/drive/chromeos/change_list_loader_observer.h"
21 #include "components/drive/chromeos/change_list_processor.h" 21 #include "components/drive/chromeos/change_list_processor.h"
22 #include "components/drive/chromeos/resource_metadata.h" 22 #include "components/drive/chromeos/resource_metadata.h"
23 #include "components/drive/drive_api_util.h"
23 #include "components/drive/event_logger.h" 24 #include "components/drive/event_logger.h"
24 #include "components/drive/file_system_core_util.h" 25 #include "components/drive/file_system_core_util.h"
25 #include "components/drive/job_scheduler.h" 26 #include "components/drive/job_scheduler.h"
26 #include "google_apis/drive/drive_api_parser.h" 27 #include "google_apis/drive/drive_api_parser.h"
27 #include "url/gurl.h" 28 #include "url/gurl.h"
28 29
29 namespace drive { 30 namespace drive {
30 namespace internal { 31 namespace internal {
31 32
32 namespace { 33 namespace {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 callback.Run(error); 136 callback.Run(error);
136 return; 137 return;
137 } 138 }
138 139
139 DCHECK(file_list); 140 DCHECK(file_list);
140 std::unique_ptr<ChangeList> change_list(new ChangeList(*file_list)); 141 std::unique_ptr<ChangeList> change_list(new ChangeList(*file_list));
141 GURL next_url = file_list->next_link(); 142 GURL next_url = file_list->next_link();
142 143
143 ResourceEntryVector* entries = new ResourceEntryVector; 144 ResourceEntryVector* entries = new ResourceEntryVector;
144 loader_->loader_controller_->ScheduleRun(base::Bind( 145 loader_->loader_controller_->ScheduleRun(base::Bind(
145 base::IgnoreResult( 146 &drive::util::RunAsyncTask,
146 &base::PostTaskAndReplyWithResult<FileError, FileError>),
147 base::RetainedRef(loader_->blocking_task_runner_), FROM_HERE, 147 base::RetainedRef(loader_->blocking_task_runner_), FROM_HERE,
148 base::Bind(&ChangeListProcessor::RefreshDirectory, 148 base::Bind(&ChangeListProcessor::RefreshDirectory,
149 loader_->resource_metadata_, directory_fetch_info_, 149 loader_->resource_metadata_, directory_fetch_info_,
150 base::Passed(&change_list), entries), 150 base::Passed(&change_list), entries),
151 base::Bind(&FeedFetcher::OnDirectoryRefreshed, 151 base::Bind(&FeedFetcher::OnDirectoryRefreshed,
152 weak_ptr_factory_.GetWeakPtr(), callback, next_url, 152 weak_ptr_factory_.GetWeakPtr(), callback, next_url,
153 base::Owned(entries)))); 153 base::Owned(entries))));
154 } 154 }
155 155
156 void OnDirectoryRefreshed( 156 void OnDirectoryRefreshed(
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 // Also notify the observers. 568 // Also notify the observers.
569 if (error == FILE_ERROR_OK && !directory_path->empty()) { 569 if (error == FILE_ERROR_OK && !directory_path->empty()) {
570 for (auto& observer : observers_) 570 for (auto& observer : observers_)
571 observer.OnDirectoryReloaded(*directory_path); 571 observer.OnDirectoryReloaded(*directory_path);
572 } 572 }
573 } 573 }
574 574
575 } // namespace internal 575 } // namespace internal
576 } // namespace drive 576 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/chromeos/change_list_loader.cc ('k') | components/drive/chromeos/file_system/search_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698