OLD | NEW |
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 "webkit/browser/fileapi/file_system_context.h" | 5 #include "webkit/browser/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 return false; | 472 return false; |
473 #if defined(OS_CHROMEOS) | 473 #if defined(OS_CHROMEOS) |
474 if (url.type() == kFileSystemTypeTemporary && | 474 if (url.type() == kFileSystemTypeTemporary && |
475 sandbox_backend_->enable_temporary_file_system_in_incognito()) { | 475 sandbox_backend_->enable_temporary_file_system_in_incognito()) { |
476 return true; | 476 return true; |
477 } | 477 } |
478 #endif | 478 #endif |
479 return !is_incognito_ || !FileSystemContext::IsSandboxFileSystem(url.type()); | 479 return !is_incognito_ || !FileSystemContext::IsSandboxFileSystem(url.type()); |
480 } | 480 } |
481 | 481 |
| 482 bool FileSystemContext::ShouldFlushOnWriteCompletion( |
| 483 FileSystemType type) const { |
| 484 if (IsSandboxFileSystem(type)) { |
| 485 // Disable Flush() for each write operation on SandboxFileSystems since it |
| 486 // hurts the performance, assuming the FileSystems are stored in a local |
| 487 // disk, we don't need to keep calling fsync() for it. |
| 488 // On the other hand, other FileSystems that may stored on a removable media |
| 489 // should be Flush()ed as soon as a write operation is completed, so that |
| 490 // written data is saved over sudden media removal. |
| 491 return false; |
| 492 } |
| 493 return true; |
| 494 } |
| 495 |
482 void FileSystemContext::OpenPluginPrivateFileSystem( | 496 void FileSystemContext::OpenPluginPrivateFileSystem( |
483 const GURL& origin_url, | 497 const GURL& origin_url, |
484 FileSystemType type, | 498 FileSystemType type, |
485 const std::string& filesystem_id, | 499 const std::string& filesystem_id, |
486 const std::string& plugin_id, | 500 const std::string& plugin_id, |
487 OpenFileSystemMode mode, | 501 OpenFileSystemMode mode, |
488 const StatusCallback& callback) { | 502 const StatusCallback& callback) { |
489 DCHECK(plugin_private_backend_); | 503 DCHECK(plugin_private_backend_); |
490 plugin_private_backend_->OpenPrivateFileSystem( | 504 plugin_private_backend_->OpenPrivateFileSystem( |
491 origin_url, type, filesystem_id, plugin_id, mode, callback); | 505 origin_url, type, filesystem_id, plugin_id, mode, callback); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } else if (parent != child) { | 621 } else if (parent != child) { |
608 bool result = parent.AppendRelativePath(child, &path); | 622 bool result = parent.AppendRelativePath(child, &path); |
609 DCHECK(result); | 623 DCHECK(result); |
610 } | 624 } |
611 | 625 |
612 operation_runner()->GetMetadata( | 626 operation_runner()->GetMetadata( |
613 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); | 627 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); |
614 } | 628 } |
615 | 629 |
616 } // namespace fileapi | 630 } // namespace fileapi |
OLD | NEW |