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

Side by Side Diff: chrome/browser/file_system/file_system_dispatcher_host.cc

Issue 3604006: Revert 61462 - Add truncate and cancel for FileWriter; write and more tests w... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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
« no previous file with comments | « base/file_util_proxy.cc ('k') | chrome/common/file_system/file_system_dispatcher.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/file_system/file_system_dispatcher_host.h" 5 #include "chrome/browser/file_system/file_system_dispatcher_host.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/thread.h" 8 #include "base/thread.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 GetNewOperation(request_id)->TouchFile( 231 GetNewOperation(request_id)->TouchFile(
232 path, last_access_time, last_modified_time); 232 path, last_access_time, last_modified_time);
233 } 233 }
234 234
235 void FileSystemDispatcherHost::OnCancel( 235 void FileSystemDispatcherHost::OnCancel(
236 int request_id, 236 int request_id,
237 int request_id_to_cancel) { 237 int request_id_to_cancel) {
238 fileapi::FileSystemOperation* write = 238 fileapi::FileSystemOperation* write =
239 operations_.Lookup(request_id_to_cancel); 239 operations_.Lookup(request_id_to_cancel);
240 if (write) { 240 if (write) {
241 // The cancel will eventually send both the write failure and the cancel 241 write->Cancel();
242 // success. 242 Send(new ViewMsg_FileSystem_DidSucceed(request_id));
243 write->Cancel(GetNewOperation(request_id));
244 } else { 243 } else {
245 // The write already finished; report that we failed to stop it.
246 Send(new ViewMsg_FileSystem_DidFail( 244 Send(new ViewMsg_FileSystem_DidFail(
247 request_id, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); 245 request_id, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
248 } 246 }
249 } 247 }
250 248
251 void FileSystemDispatcherHost::Send(IPC::Message* message) { 249 void FileSystemDispatcherHost::Send(IPC::Message* message) {
252 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 250 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
253 if (!shutdown_ && message_sender_) 251 if (!shutdown_ && message_sender_)
254 message_sender_->Send(message); 252 message_sender_->Send(message);
255 else 253 else
(...skipping 20 matching lines...) Expand all
276 dispatcher, 274 dispatcher,
277 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)); 275 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE));
278 operations_.AddWithID(operation, request_id); 276 operations_.AddWithID(operation, request_id);
279 return operation; 277 return operation;
280 } 278 }
281 279
282 void FileSystemDispatcherHost::RemoveCompletedOperation(int request_id) { 280 void FileSystemDispatcherHost::RemoveCompletedOperation(int request_id) {
283 DCHECK(operations_.Lookup(request_id)); 281 DCHECK(operations_.Lookup(request_id));
284 operations_.Remove(request_id); 282 operations_.Remove(request_id);
285 } 283 }
OLDNEW
« no previous file with comments | « base/file_util_proxy.cc ('k') | chrome/common/file_system/file_system_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698