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

Unified Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h

Issue 440653003: [fsp] Add support for aborting running operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
index 830969ef72d203ab199546b907c1767344fc1943..91d3f71dc5a469693ccb417bd649321824303b7e 100644
--- a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
+++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
@@ -7,8 +7,10 @@
#include <map>
#include <string>
+#include <vector>
#include "base/memory/weak_ptr.h"
+#include "base/task/cancelable_task_tracker.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
@@ -67,51 +69,52 @@ class FakeProvidedFileSystem : public ProvidedFileSystemInterface {
bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const;
// ProvidedFileSystemInterface overrides.
- virtual void RequestUnmount(
+ virtual AbortCallback RequestUnmount(
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void GetMetadata(
+ virtual AbortCallback GetMetadata(
const base::FilePath& entry_path,
const ProvidedFileSystemInterface::GetMetadataCallback& callback)
OVERRIDE;
- virtual void ReadDirectory(
+ virtual AbortCallback ReadDirectory(
const base::FilePath& directory_path,
const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE;
- virtual void OpenFile(const base::FilePath& file_path,
- OpenFileMode mode,
- const OpenFileCallback& callback) OVERRIDE;
- virtual void CloseFile(
+ virtual AbortCallback OpenFile(const base::FilePath& file_path,
hirono 2014/08/06 08:33:50 nit: Make it the rule of breaking lines consistent
mtomasz 2014/08/08 06:29:40 It is done by git cl format. AFAIR it is correct.
hirono 2014/08/08 07:23:38 Acknowledged.
+ OpenFileMode mode,
+ const OpenFileCallback& callback) OVERRIDE;
+ virtual AbortCallback CloseFile(
int file_handle,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void ReadFile(int file_handle,
- net::IOBuffer* buffer,
- int64 offset,
- int length,
- const ReadChunkReceivedCallback& callback) OVERRIDE;
- virtual void CreateDirectory(
+ virtual AbortCallback ReadFile(
+ int file_handle,
+ net::IOBuffer* buffer,
+ int64 offset,
+ int length,
+ const ReadChunkReceivedCallback& callback) OVERRIDE;
+ virtual AbortCallback CreateDirectory(
const base::FilePath& directory_path,
bool exclusive,
bool recursive,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void DeleteEntry(
+ virtual AbortCallback DeleteEntry(
const base::FilePath& entry_path,
bool recursive,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void CreateFile(
+ virtual AbortCallback CreateFile(
const base::FilePath& file_path,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void CopyEntry(
+ virtual AbortCallback CopyEntry(
const base::FilePath& source_path,
const base::FilePath& target_path,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void MoveEntry(
+ virtual AbortCallback MoveEntry(
const base::FilePath& source_path,
const base::FilePath& target_path,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void Truncate(
+ virtual AbortCallback Truncate(
const base::FilePath& file_path,
int64 length,
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
- virtual void WriteFile(
+ virtual AbortCallback WriteFile(
int file_handle,
net::IOBuffer* buffer,
int64 offset,
@@ -131,12 +134,24 @@ class FakeProvidedFileSystem : public ProvidedFileSystemInterface {
typedef std::map<base::FilePath, FakeEntry> Entries;
typedef std::map<int, base::FilePath> OpenedFilesMap;
+ // Aborts a request. |task_id| refers to a posted callback returning a
+ // response for the operation, which will be cancelled, hence not called.
+ void Abort(int task_id,
+ const fileapi::AsyncFileUtil::StatusCallback& callback);
+
+ // Aborts a request. |task_ids| refers to a vector of posted callbacks
+ // returning a response for the operation, which will be cancelled, hence not
+ // called.
+ void AbortMany(const std::vector<int>& task_ids,
+ const fileapi::AsyncFileUtil::StatusCallback& callback);
+
ProvidedFileSystemInfo file_system_info_;
Entries entries_;
OpenedFilesMap opened_files_;
int last_file_handle_;
+ base::CancelableTaskTracker tracker_;
- base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_;
+ base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
};

Powered by Google App Engine
This is Rietveld 408576698