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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc

Issue 845083005: [fsp] Simplify aborting logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a comment. Created 5 years, 11 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 "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h" 5 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "net/base/io_buffer.h" 8 #include "net/base/io_buffer.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 383
384 AbortCallback FakeProvidedFileSystem::PostAbortableTask( 384 AbortCallback FakeProvidedFileSystem::PostAbortableTask(
385 const base::Closure& callback) { 385 const base::Closure& callback) {
386 const int task_id = tracker_.PostTask( 386 const int task_id = tracker_.PostTask(
387 base::MessageLoopProxy::current().get(), FROM_HERE, callback); 387 base::MessageLoopProxy::current().get(), FROM_HERE, callback);
388 return base::Bind( 388 return base::Bind(
389 &FakeProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), task_id); 389 &FakeProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), task_id);
390 } 390 }
391 391
392 void FakeProvidedFileSystem::Abort( 392 void FakeProvidedFileSystem::Abort(int task_id) {
393 int task_id,
394 const storage::AsyncFileUtil::StatusCallback& callback) {
395 tracker_.TryCancel(task_id); 393 tracker_.TryCancel(task_id);
396 callback.Run(base::File::FILE_OK);
397 } 394 }
398 395
399 void FakeProvidedFileSystem::AbortMany( 396 void FakeProvidedFileSystem::AbortMany(const std::vector<int>& task_ids) {
400 const std::vector<int>& task_ids,
401 const storage::AsyncFileUtil::StatusCallback& callback) {
402 for (size_t i = 0; i < task_ids.size(); ++i) { 397 for (size_t i = 0; i < task_ids.size(); ++i) {
403 tracker_.TryCancel(task_ids[i]); 398 tracker_.TryCancel(task_ids[i]);
404 } 399 }
405 callback.Run(base::File::FILE_OK);
406 } 400 }
407 401
408 } // namespace file_system_provider 402 } // namespace file_system_provider
409 } // namespace chromeos 403 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698