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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc

Issue 10600013: Wired support for file truncating with RemoteFileSystemOperation::OpenFile() method (case when base… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gdata/gdata_file_system_proxy.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 using fileapi::FileSystemOperationInterface; 25 using fileapi::FileSystemOperationInterface;
26 using webkit_blob::ShareableFileReference; 26 using webkit_blob::ShareableFileReference;
27 27
28 namespace { 28 namespace {
29 29
30 const char kGDataRootDirectory[] = "drive"; 30 const char kGDataRootDirectory[] = "drive";
31 const char kFeedField[] = "feed"; 31 const char kFeedField[] = "feed";
32 32
33 33
34 // Helper function that creates platform file on bocking IO thread pool. 34 // Helper function that creates platform file on bocking IO thread pool.
35 void CreatePlatformFileOnIOPool(const FilePath& local_path, 35 void OpenPlatformFileOnIOPool(const FilePath& local_path,
36 int file_flags, 36 int file_flags,
37 base::PlatformFile* platform_file, 37 base::PlatformFile* platform_file,
38 base::PlatformFileError* open_error) { 38 base::PlatformFileError* open_error) {
39 bool created; 39 bool created;
40 *platform_file = base::CreatePlatformFile(local_path, 40 *platform_file = base::CreatePlatformFile(local_path,
41 file_flags, 41 file_flags,
42 &created, 42 &created,
43 open_error); 43 open_error);
44 } 44 }
45 45
46 // Helper function to run reply on results of CreatePlatformFileOnIOPool() on 46 // Helper function to run reply on results of OpenPlatformFileOnIOPool() on
47 // IO thread. 47 // IO thread.
48 void OnPlatformFileCreated( 48 void OnPlatformFileOpened(
49 const FileSystemOperationInterface::OpenFileCallback& callback, 49 const FileSystemOperationInterface::OpenFileCallback& callback,
50 base::ProcessHandle peer_handle, 50 base::ProcessHandle peer_handle,
51 base::PlatformFile* platform_file, 51 base::PlatformFile* platform_file,
52 base::PlatformFileError* open_error) { 52 base::PlatformFileError* open_error) {
53 callback.Run(*open_error, *platform_file, peer_handle); 53 callback.Run(*open_error, *platform_file, peer_handle);
54 } 54 }
55 55
56 // Helper function to run OpenFileCallback from 56 // Helper function to run OpenFileCallback from
57 // GDataFileSystemProxy::OpenFile(). 57 // GDataFileSystemProxy::OpenFile().
58 void OnGetFileByPathForOpen( 58 void OnGetFileByPathForOpen(
59 const FileSystemOperationInterface::OpenFileCallback& callback, 59 const FileSystemOperationInterface::OpenFileCallback& callback,
60 int file_flags, 60 int file_flags,
61 base::ProcessHandle peer_handle, 61 base::ProcessHandle peer_handle,
62 base::PlatformFileError error, 62 base::PlatformFileError error,
63 const FilePath& local_path, 63 const FilePath& local_path,
64 const std::string& unused_mime_type, 64 const std::string& unused_mime_type,
65 gdata::GDataFileType file_type) { 65 gdata::GDataFileType file_type) {
66 if (error != base::PLATFORM_FILE_OK) { 66 if (error != base::PLATFORM_FILE_OK) {
67 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); 67 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle);
68 return; 68 return;
69 } 69 }
70 70
71 base::PlatformFile* platform_file = new base::PlatformFile( 71 base::PlatformFile* platform_file = new base::PlatformFile(
72 base::kInvalidPlatformFileValue); 72 base::kInvalidPlatformFileValue);
73 base::PlatformFileError* open_error = 73 base::PlatformFileError* open_error =
74 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED); 74 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
75 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, 75 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
76 base::Bind(&CreatePlatformFileOnIOPool, 76 base::Bind(&OpenPlatformFileOnIOPool,
77 local_path, 77 local_path,
78 file_flags, 78 file_flags,
79 platform_file, 79 platform_file,
80 open_error), 80 open_error),
81 base::Bind(&OnPlatformFileCreated, 81 base::Bind(&OnPlatformFileOpened,
82 callback, 82 callback,
83 peer_handle, 83 peer_handle,
84 base::Owned(platform_file), 84 base::Owned(platform_file),
85 base::Owned(open_error))); 85 base::Owned(open_error)));
86 86
87 } 87 }
88 88
89 // Helper function to run SnapshotFileCallback from 89 // Helper function to run SnapshotFileCallback from
90 // GDataFileSystemProxy::CreateSnapshotFile(). 90 // GDataFileSystemProxy::CreateSnapshotFile().
91 void CallSnapshotFileCallback( 91 void CallSnapshotFileCallback(
(...skipping 23 matching lines...) Expand all
115 base::PlatformFileInfo final_file_info(file_info); 115 base::PlatformFileInfo final_file_info(file_info);
116 final_file_info.last_modified = base::Time(); 116 final_file_info.last_modified = base::Time();
117 117
118 callback.Run(error, final_file_info, local_path, file_ref); 118 callback.Run(error, final_file_info, local_path, file_ref);
119 } 119 }
120 120
121 void OnClose(const FilePath& local_path, base::PlatformFileError error_code) { 121 void OnClose(const FilePath& local_path, base::PlatformFileError error_code) {
122 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code; 122 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code;
123 } 123 }
124 124
125 void OpenAndTruncateOnIOPool(
kinaba 2012/06/27 09:17:21 I think we can simply use OpenPlatformFileOnIOPool
zel 2012/06/27 22:20:45 I see. Done.
126 const FilePath& local_cache_path,
127 base::PlatformFile* platform_file,
128 base::PlatformFileError* result) {
129 base::PlatformFile file = base::CreatePlatformFile(
130 local_cache_path,
131 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
132 NULL,
133 result);
134 if (*result == base::PLATFORM_FILE_OK) {
135 DCHECK_NE(base::kInvalidPlatformFileValue, file);
136 if (!base::TruncatePlatformFile(file, 0)) {
137 base::ClosePlatformFile(file);
138 *result = base::PLATFORM_FILE_ERROR_FAILED;
139 file = base::kInvalidPlatformFileValue;
140 }
141 }
142 *platform_file = file;
143 }
144
125 void DoTruncateOnFileThread( 145 void DoTruncateOnFileThread(
126 const FilePath& local_cache_path, 146 const FilePath& local_cache_path,
127 int64 length, 147 int64 length,
128 base::PlatformFileError* result) { 148 base::PlatformFileError* result) {
129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
130 150
131 base::PlatformFile file = base::CreatePlatformFile( 151 base::PlatformFile file = base::CreatePlatformFile(
132 local_cache_path, 152 local_cache_path,
133 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE, 153 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
134 NULL, 154 NULL,
135 result); 155 result);
136 if (*result == base::PLATFORM_FILE_OK) { 156 if (*result == base::PLATFORM_FILE_OK) {
137 DCHECK_NE(base::kInvalidPlatformFileValue, file); 157 DCHECK_NE(base::kInvalidPlatformFileValue, file);
138 if (!base::TruncatePlatformFile(file, length)) 158 if (!base::TruncatePlatformFile(file, length))
139 *result = base::PLATFORM_FILE_ERROR_FAILED; 159 *result = base::PLATFORM_FILE_ERROR_FAILED;
140 base::ClosePlatformFile(file); 160 base::ClosePlatformFile(file);
141 } 161 }
142 } 162 }
143 163
144 void DidCloseFileForTruncate( 164 void DidCloseFileForTruncate(
145 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 165 const FileSystemOperationInterface::StatusCallback& callback,
146 base::PlatformFileError truncate_result, 166 base::PlatformFileError truncate_result,
147 base::PlatformFileError close_result) { 167 base::PlatformFileError close_result) {
148 // Reports the first error. 168 // Reports the first error.
149 callback.Run(truncate_result == base::PLATFORM_FILE_OK ? close_result 169 callback.Run(truncate_result == base::PLATFORM_FILE_OK ? close_result
150 : truncate_result); 170 : truncate_result);
151 } 171 }
152 172
153 } // namespace 173 } // namespace
154 174
155 namespace gdata { 175 namespace gdata {
(...skipping 17 matching lines...) Expand all
173 GDataFileSystemInterface* file_system) 193 GDataFileSystemInterface* file_system)
174 : file_system_(file_system) { 194 : file_system_(file_system) {
175 // Should be created from the file browser extension API (AddMountFunction) 195 // Should be created from the file browser extension API (AddMountFunction)
176 // on UI thread. 196 // on UI thread.
177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
178 } 198 }
179 199
180 void GDataFileSystemProxy::GetFileInfo(const GURL& file_url, 200 void GDataFileSystemProxy::GetFileInfo(const GURL& file_url,
181 const FileSystemOperationInterface::GetMetadataCallback& callback) { 201 const FileSystemOperationInterface::GetMetadataCallback& callback) {
182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
183
184 FilePath file_path; 203 FilePath file_path;
185 if (!ValidateUrl(file_url, &file_path)) { 204 if (!ValidateUrl(file_url, &file_path)) {
186 base::MessageLoopProxy::current()->PostTask( 205 MessageLoopProxy::current()->PostTask(FROM_HERE,
187 FROM_HERE, 206 base::Bind(callback,
188 base::Bind(callback, 207 base::PLATFORM_FILE_ERROR_NOT_FOUND,
189 base::PLATFORM_FILE_ERROR_NOT_FOUND, 208 base::PlatformFileInfo(),
190 base::PlatformFileInfo(), 209 FilePath()));
191 FilePath()));
192 return; 210 return;
193 } 211 }
194 212
195 file_system_->GetEntryInfoByPath( 213 file_system_->GetEntryInfoByPath(
196 file_path, 214 file_path,
197 base::Bind(&GDataFileSystemProxy::OnGetMetadata, 215 base::Bind(&GDataFileSystemProxy::OnGetMetadata,
198 this, 216 this,
199 file_path, 217 file_path,
200 callback)); 218 callback));
201 } 219 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (!ValidateUrl(file_url, &file_path)) { 297 if (!ValidateUrl(file_url, &file_path)) {
280 MessageLoopProxy::current()->PostTask(FROM_HERE, 298 MessageLoopProxy::current()->PostTask(FROM_HERE,
281 base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); 299 base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
282 return; 300 return;
283 } 301 }
284 302
285 file_system_->CreateDirectory(file_path, exclusive, recursive, callback); 303 file_system_->CreateDirectory(file_path, exclusive, recursive, callback);
286 } 304 }
287 305
288 void GDataFileSystemProxy::Truncate(const GURL& file_url, int64 length, 306 void GDataFileSystemProxy::Truncate(const GURL& file_url, int64 length,
289 const fileapi::FileSystemOperationInterface::StatusCallback& callback) { 307 const FileSystemOperationInterface::StatusCallback& callback) {
290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
291 309
292 if (length < 0) { 310 if (length < 0) {
293 MessageLoopProxy::current()->PostTask(FROM_HERE, 311 MessageLoopProxy::current()->PostTask(FROM_HERE,
294 base::Bind(callback, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); 312 base::Bind(callback, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
295 return; 313 return;
296 } 314 }
297 315
298 FilePath file_path; 316 FilePath file_path;
299 if (!ValidateUrl(file_url, &file_path)) { 317 if (!ValidateUrl(file_url, &file_path)) {
300 MessageLoopProxy::current()->PostTask(FROM_HERE, 318 MessageLoopProxy::current()->PostTask(FROM_HERE,
301 base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); 319 base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
302 return; 320 return;
303 } 321 }
304 322
305 // TODO(kinaba): http://crbug.com/132780. 323 // TODO(kinaba): http://crbug.com/132780.
306 // Optimize the cases for small |length|, at least for |length| == 0. 324 // Optimize the cases for small |length|, at least for |length| == 0.
307 // CreateWritableSnapshotFile downloads the whole content unnecessarily. 325 // CreateWritableSnapshotFile downloads the whole content unnecessarily.
308 file_system_->OpenFile( 326 file_system_->OpenFile(
309 file_path, 327 file_path,
310 base::Bind(&GDataFileSystemProxy::OnFileOpenedForTruncate, 328 base::Bind(&GDataFileSystemProxy::OnFileOpenedForTruncate,
311 this, 329 this,
312 file_path, 330 file_path,
313 length, 331 length,
314 callback)); 332 callback));
315 } 333 }
316 334
335 void GDataFileSystemProxy::OnOpenFileForWriting(
336 int file_flags,
337 base::ProcessHandle peer_handle,
338 const FileSystemOperationInterface::OpenFileCallback& callback,
339 base::PlatformFileError open_result,
340 const FilePath& local_cache_path) {
341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
342
343 if (open_result != base::PLATFORM_FILE_OK) {
344 callback.Run(open_result, base::kInvalidPlatformFileValue, peer_handle);
345 return;
346 }
347
348 // Cache file prepared for modification is available. Truncate it.
349 // File operation must be done on FILE thread, so relay the operation.
350 base::PlatformFileError* result =
351 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
352 base::PlatformFile* platform_file = new base::PlatformFile(
353 base::kInvalidPlatformFileValue);
354 bool posted = false;
355 if (file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED) {
kinaba 2012/06/27 09:17:21 As noted above, I don't think this branching is ne
zel 2012/06/27 22:20:45 Done.
356 // Perform file truncate operation.
357 posted = BrowserThread::GetBlockingPool()->PostTaskAndReply(
358 FROM_HERE,
359 base::Bind(&OpenAndTruncateOnIOPool,
360 local_cache_path,
361 platform_file,
362 result),
363 base::Bind(&GDataFileSystemProxy::OnOpenAndTruncate,
364 this,
365 peer_handle,
366 callback,
367 base::Owned(platform_file),
368 base::Owned(result)));
369 } else {
370 // Perform file open operation.
371 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
372 base::Bind(&OpenPlatformFileOnIOPool,
373 local_cache_path,
374 file_flags,
375 platform_file,
376 result),
377 base::Bind(&OnPlatformFileOpened,
378 callback,
379 peer_handle,
380 base::Owned(platform_file),
381 base::Owned(result)));
382 }
383 DCHECK(posted);
384 }
385
317 void GDataFileSystemProxy::OnFileOpenedForTruncate( 386 void GDataFileSystemProxy::OnFileOpenedForTruncate(
318 const FilePath& virtual_path, 387 const FilePath& virtual_path,
319 int64 length, 388 int64 length,
320 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 389 const FileSystemOperationInterface::StatusCallback& callback,
321 base::PlatformFileError open_result, 390 base::PlatformFileError open_result,
322 const FilePath& local_cache_path) { 391 const FilePath& local_cache_path) {
323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
324 393
325 if (open_result != base::PLATFORM_FILE_OK) { 394 if (open_result != base::PLATFORM_FILE_OK) {
326 callback.Run(open_result); 395 callback.Run(open_result);
327 return; 396 return;
328 } 397 }
329 398
330 // Cache file prepared for modification is available. Truncate it. 399 // Cache file prepared for modification is available. Truncate it.
(...skipping 10 matching lines...) Expand all
341 base::Bind(&GDataFileSystemProxy::DidTruncate, 410 base::Bind(&GDataFileSystemProxy::DidTruncate,
342 this, 411 this,
343 virtual_path, 412 virtual_path,
344 callback, 413 callback,
345 base::Owned(result))); 414 base::Owned(result)));
346 DCHECK(posted); 415 DCHECK(posted);
347 } 416 }
348 417
349 void GDataFileSystemProxy::DidTruncate( 418 void GDataFileSystemProxy::DidTruncate(
350 const FilePath& virtual_path, 419 const FilePath& virtual_path,
351 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 420 const FileSystemOperationInterface::StatusCallback& callback,
352 base::PlatformFileError* truncate_result) { 421 base::PlatformFileError* truncate_result) {
353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 422 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
354 423
355 // Truncation finished. We must close the file no matter |truncate_result| 424 // Truncation finished. We must close the file no matter |truncate_result|
356 // indicates an error or not. 425 // indicates an error or not.
357 file_system_->CloseFile(virtual_path, base::Bind(&DidCloseFileForTruncate, 426 file_system_->CloseFile(virtual_path, base::Bind(&DidCloseFileForTruncate,
358 callback, 427 callback,
359 *truncate_result)); 428 *truncate_result));
360 } 429 }
361 430
431
432 void GDataFileSystemProxy::OnOpenAndTruncate(
433 base::ProcessHandle peer_handle,
434 const FileSystemOperationInterface::OpenFileCallback& callback,
435 base::PlatformFile* platform_file,
436 base::PlatformFileError* truncate_result) {
437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
438 callback.Run(*truncate_result, *platform_file, peer_handle);
439 }
440
362 void GDataFileSystemProxy::OpenFile( 441 void GDataFileSystemProxy::OpenFile(
363 const GURL& file_url, 442 const GURL& file_url,
364 int file_flags, 443 int file_flags,
365 base::ProcessHandle peer_handle, 444 base::ProcessHandle peer_handle,
366 const FileSystemOperationInterface::OpenFileCallback& callback) { 445 const FileSystemOperationInterface::OpenFileCallback& callback) {
367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
368 447
369 FilePath file_path; 448 FilePath file_path;
370 if (!ValidateUrl(file_url, &file_path)) { 449 if (!ValidateUrl(file_url, &file_path)) {
371 MessageLoopProxy::current()->PostTask(FROM_HERE, 450 MessageLoopProxy::current()->PostTask(FROM_HERE,
372 base::Bind(callback, 451 base::Bind(callback,
373 base::PLATFORM_FILE_ERROR_NOT_FOUND, 452 base::PLATFORM_FILE_ERROR_NOT_FOUND,
374 base::kInvalidPlatformFileValue, 453 base::kInvalidPlatformFileValue,
375 peer_handle)); 454 peer_handle));
376 return; 455 return;
377 } 456 }
378 457
379 file_system_->GetFileByPath(file_path, 458 // TODO(zelidrag): Wire all other file open operations.
380 base::Bind(&OnGetFileByPathForOpen, 459 if ((file_flags & base::PLATFORM_FILE_CREATE) ||
381 callback, 460 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS) ||
382 file_flags, 461 (file_flags & base::PLATFORM_FILE_DELETE_ON_CLOSE)) {
kinaba 2012/06/27 09:17:21 base::PLATFORM_FILE_OPEN_ALWAYS (if exist=>open el
zel 2012/06/27 22:20:45 Done.
383 peer_handle), 462 NOTIMPLEMENTED() << "File create/write operations not yet supported "
384 GetDownloadDataCallback()); 463 << file_path.value();
464 MessageLoopProxy::current()->PostTask(FROM_HERE,
465 base::Bind(callback,
466 base::PLATFORM_FILE_ERROR_FAILED,
467 base::kInvalidPlatformFileValue,
468 peer_handle));
469 return;
470 }
471
472 if ((file_flags & base::PLATFORM_FILE_OPEN) ||
473 (file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED)) {
474 if ((file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED) ||
475 (file_flags & base::PLATFORM_FILE_WRITE) ||
476 (file_flags & base::PLATFORM_FILE_EXCLUSIVE_WRITE)) {
477 // Open existing file for writing.
478 file_system_->OpenFile(
479 file_path,
480 base::Bind(&GDataFileSystemProxy::OnOpenFileForWriting,
481 this,
482 file_flags,
483 peer_handle,
484 callback));
485 } else {
486 // Read-only file open.
487 file_system_->GetFileByPath(file_path,
488 base::Bind(&OnGetFileByPathForOpen,
489 callback,
490 file_flags,
491 peer_handle),
492 GetDownloadDataCallback());
493 }
494 }
kinaba 2012/06/27 09:17:21 It might be slightly safer to callback failure whe
zel 2012/06/27 22:20:45 Done.
495 // TODO(zelidrag): Wire file create operation.
496 }
497
498 void GDataFileSystemProxy::NotifyFileClosed(
499 const GURL& file_url,
500 const FileSystemOperationInterface::StatusCallback& callback) {
501 FilePath file_path;
502 if (!ValidateUrl(file_url, &file_path)) {
503 MessageLoopProxy::current()->PostTask(FROM_HERE,
504 base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
505 return;
506 }
507 file_system_->CloseFile(file_path, callback);
385 } 508 }
386 509
387 void GDataFileSystemProxy::CreateSnapshotFile( 510 void GDataFileSystemProxy::CreateSnapshotFile(
388 const GURL& file_url, 511 const GURL& file_url,
389 const FileSystemOperationInterface::SnapshotFileCallback& callback) { 512 const FileSystemOperationInterface::SnapshotFileCallback& callback) {
390 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 513 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
391 514
392 FilePath file_path; 515 FilePath file_path;
393 if (!ValidateUrl(file_url, &file_path)) { 516 if (!ValidateUrl(file_url, &file_path)) {
394 MessageLoopProxy::current()->PostTask(FROM_HERE, 517 MessageLoopProxy::current()->PostTask(FROM_HERE,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 675
553 void GDataFileSystemProxy::CloseWritableSnapshotFile( 676 void GDataFileSystemProxy::CloseWritableSnapshotFile(
554 const FilePath& virtual_path, 677 const FilePath& virtual_path,
555 const FilePath& local_path) { 678 const FilePath& local_path) {
556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 679 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
557 680
558 file_system_->CloseFile(virtual_path, base::Bind(&OnClose, virtual_path)); 681 file_system_->CloseFile(virtual_path, base::Bind(&OnClose, virtual_path));
559 } 682 }
560 683
561 } // namespace gdata 684 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_proxy.h ('k') | content/browser/fileapi/fileapi_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698