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

Side by Side Diff: chrome/browser/chromeos/drive/fileapi_worker.h

Issue 19596003: Remove CloseFile from FileSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This file provides the core implementation of fileapi methods. 5 // This file provides the core implementation of fileapi methods.
6 // The functions should be called on UI thread. 6 // The functions should be called on UI thread.
7 // Note that most method invocation of fileapi is done on IO thread. The gap is 7 // Note that most method invocation of fileapi is done on IO thread. The gap is
8 // filled by FileSystemProxy. 8 // filled by FileSystemProxy.
9 // Also, the order of arguments for the functions which take FileSystemInterface 9 // Also, the order of arguments for the functions which take FileSystemInterface
10 // at the last is intentional. The instance of FileSystemInterface should be 10 // at the last is intentional. The instance of FileSystemInterface should be
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const std::vector<fileapi::DirectoryEntry>& file_list, 54 const std::vector<fileapi::DirectoryEntry>& file_list,
55 bool has_more)> ReadDirectoryCallback; 55 bool has_more)> ReadDirectoryCallback;
56 typedef base::Callback< 56 typedef base::Callback<
57 void(base::PlatformFileError result, 57 void(base::PlatformFileError result,
58 const base::PlatformFileInfo& file_info, 58 const base::PlatformFileInfo& file_info,
59 const base::FilePath& snapshot_file_path, 59 const base::FilePath& snapshot_file_path,
60 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy)> 60 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy)>
61 CreateSnapshotFileCallback; 61 CreateSnapshotFileCallback;
62 typedef base::Callback< 62 typedef base::Callback<
63 void(base::PlatformFileError result, 63 void(base::PlatformFileError result,
64 const base::FilePath& snapshot_file_path)> 64 const base::FilePath& snapshot_file_path,
65 const base::Closure& close_callback)>
65 CreateWritableSnapshotFileCallback; 66 CreateWritableSnapshotFileCallback;
66 typedef base::Callback< 67 typedef base::Callback<
67 void(base::PlatformFileError result, 68 void(base::PlatformFileError result,
68 base::PlatformFile platform_file)> OpenFileCallback; 69 base::PlatformFile platform_file,
70 const base::Closure& close_callback)> OpenFileCallback;
69 71
70 // Runs |file_system_getter| to obtain the instance of FileSystemInstance, 72 // Runs |file_system_getter| to obtain the instance of FileSystemInstance,
71 // and then runs |callback| with it. 73 // and then runs |callback| with it.
72 // If |file_system_getter| returns NULL, runs |on_error_callback| instead. 74 // If |file_system_getter| returns NULL, runs |error_callback| instead.
73 // This function must be called on UI thread. 75 // This function must be called on UI thread.
74 // |file_system_getter| and |callback| must not be null, but 76 // |file_system_getter| and |callback| must not be null, but
75 // |on_error_callback| can be null (if no operation is necessary for error 77 // |error_callback| can be null (if no operation is necessary for error
76 // case). 78 // case).
77 void RunFileSystemCallback( 79 void RunFileSystemCallback(
78 const FileSystemGetter& file_system_getter, 80 const FileSystemGetter& file_system_getter,
79 const base::Callback<void(FileSystemInterface*)>& callback, 81 const base::Callback<void(FileSystemInterface*)>& callback,
80 const base::Closure& on_error_callback); 82 const base::Closure& error_callback);
81 83
82 // Returns the metadata info of the file at |file_path|. 84 // Returns the metadata info of the file at |file_path|.
83 // Called from FileSystemProxy::GetFileInfo(). 85 // Called from FileSystemProxy::GetFileInfo().
84 void GetFileInfo(const base::FilePath& file_path, 86 void GetFileInfo(const base::FilePath& file_path,
85 const GetFileInfoCallback& callback, 87 const GetFileInfoCallback& callback,
86 FileSystemInterface* file_system); 88 FileSystemInterface* file_system);
87 89
88 // Copies a file from |src_file_path| to |dest_file_path|. 90 // Copies a file from |src_file_path| to |dest_file_path|.
89 // Called from FileSystemProxy::Copy(). 91 // Called from FileSystemProxy::Copy().
90 void Copy(const base::FilePath& src_file_path, 92 void Copy(const base::FilePath& src_file_path,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const StatusCallback& callback, 143 const StatusCallback& callback,
142 FileSystemInterface* file_system); 144 FileSystemInterface* file_system);
143 145
144 // Creates a snapshot for the file at |file_path|. 146 // Creates a snapshot for the file at |file_path|.
145 // Called from FileSystemProxy::CreateSnapshotFile(). 147 // Called from FileSystemProxy::CreateSnapshotFile().
146 void CreateSnapshotFile(const base::FilePath& file_path, 148 void CreateSnapshotFile(const base::FilePath& file_path,
147 const CreateSnapshotFileCallback& callback, 149 const CreateSnapshotFileCallback& callback,
148 FileSystemInterface* file_system); 150 FileSystemInterface* file_system);
149 151
150 // Creates a writable snapshot for the file at |file_path|. 152 // Creates a writable snapshot for the file at |file_path|.
151 // After writing operation is done, CloseFile is needed to be called. 153 // After writing operation is done, |close_callback| must be called.
152 void CreateWritableSnapshotFile( 154 void CreateWritableSnapshotFile(
153 const base::FilePath& file_path, 155 const base::FilePath& file_path,
154 const CreateWritableSnapshotFileCallback& callback, 156 const CreateWritableSnapshotFileCallback& callback,
155 FileSystemInterface* file_system); 157 FileSystemInterface* file_system);
156 158
157 // Opens the file at |file_path| with options |file_flags|. 159 // Opens the file at |file_path| with options |file_flags|.
158 // Called from FileSystemProxy::OpenFile. 160 // Called from FileSystemProxy::OpenFile.
159 void OpenFile(const base::FilePath& file_path, 161 void OpenFile(const base::FilePath& file_path,
160 int file_flags, 162 int file_flags,
161 const OpenFileCallback& callback, 163 const OpenFileCallback& callback,
162 FileSystemInterface* file_system); 164 FileSystemInterface* file_system);
163 165
164 // Closes the file at |file_path|.
165 // Called from FileSystemProxy::NotifyCloseFile and
166 // FileSystemProxy::CloseWRitableSnapshotFile.
167 void CloseFile(const base::FilePath& file_path,
168 FileSystemInterface* file_system);
169
170 // Changes timestamp of the file at |file_path| to |last_access_time| and 166 // Changes timestamp of the file at |file_path| to |last_access_time| and
171 // |last_modified_time|. Called from FileSystemProxy::TouchFile(). 167 // |last_modified_time|. Called from FileSystemProxy::TouchFile().
172 void TouchFile(const base::FilePath& file_path, 168 void TouchFile(const base::FilePath& file_path,
173 const base::Time& last_access_time, 169 const base::Time& last_access_time,
174 const base::Time& last_modified_time, 170 const base::Time& last_modified_time,
175 const StatusCallback& callback, 171 const StatusCallback& callback,
176 FileSystemInterface* file_system); 172 FileSystemInterface* file_system);
177 173
178 } // namespace fileapi_internal 174 } // namespace fileapi_internal
179 } // namespace drive 175 } // namespace drive
180 176
181 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WORKER_H_ 177 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_write_helper_unittest.cc ('k') | chrome/browser/chromeos/drive/fileapi_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698