Commit ed514e8d authored by kinuko@chromium.org's avatar kinuko@chromium.org

2nd try: Notify read access to the QuotaManager in FileSystemOperation

original review page (reverted due to chromeos breakage):
http://codereview.chromium.org/7054012/

BUG=none
TEST=FileSystemOperationTest.*
TBR=ericu

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86588 0039d316-1c4b-4281-b951-d872f2087c98
parent 3690ebe0
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "webkit/fileapi/file_system_file_util_proxy.h" #include "webkit/fileapi/file_system_file_util_proxy.h"
#include "webkit/fileapi/file_system_operation_context.h" #include "webkit/fileapi/file_system_operation_context.h"
#include "webkit/fileapi/file_system_path_manager.h" #include "webkit/fileapi/file_system_path_manager.h"
#include "webkit/fileapi/file_system_quota_util.h"
#include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h" #include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/file_writer_delegate.h" #include "webkit/fileapi/file_writer_delegate.h"
...@@ -36,9 +37,6 @@ FileSystemOperation::FileSystemOperation( ...@@ -36,9 +37,6 @@ FileSystemOperation::FileSystemOperation(
#ifndef NDEBUG #ifndef NDEBUG
pending_operation_ = kOperationNone; pending_operation_ = kOperationNone;
#endif #endif
// TODO(dmikurube): Read and set available bytes from the Quota Manager.
file_system_operation_context_.set_allowed_bytes_growth(
QuotaFileUtil::kNoLimit);
} }
FileSystemOperation::~FileSystemOperation() { FileSystemOperation::~FileSystemOperation() {
...@@ -656,8 +654,9 @@ void FileSystemOperation::DidEnsureFileExistsExclusive( ...@@ -656,8 +654,9 @@ void FileSystemOperation::DidEnsureFileExistsExclusive(
if (rv == base::PLATFORM_FILE_OK && !created) { if (rv == base::PLATFORM_FILE_OK && !created) {
dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_EXISTS); dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_EXISTS);
delete this; delete this;
} else } else {
DidFinishFileOperation(rv); DidFinishFileOperation(rv);
}
} }
void FileSystemOperation::DidEnsureFileExistsNonExclusive( void FileSystemOperation::DidEnsureFileExistsNonExclusive(
...@@ -818,6 +817,18 @@ bool FileSystemOperation::VerifyFileSystemPathForRead( ...@@ -818,6 +817,18 @@ bool FileSystemOperation::VerifyFileSystemPathForRead(
file_system_context()->path_manager()->GetFileSystemFileUtil(*type); file_system_context()->path_manager()->GetFileSystemFileUtil(*type);
DCHECK(*file_system_file_util); DCHECK(*file_system_file_util);
// We notify this read access whether the read access succeeds or not.
// This must be ok since this is used to let the QM's eviction logic know
// someone is interested in reading the origin data and therefore to indicate
// that evicting this origin may not be a good idea.
FileSystemQuotaUtil* quota_util = file_system_context()->GetQuotaUtil(*type);
if (quota_util) {
quota_util->NotifyOriginWasAccessedOnIOThread(
file_system_context()->quota_manager_proxy(),
*origin_url,
*type);
}
return true; return true;
} }
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h"
#include "webkit/quota/quota_types.h"
namespace quota { namespace quota {
class QuotaManagerProxy; class QuotaManagerProxy;
...@@ -61,6 +63,9 @@ class FileSystemTestOriginHelper { ...@@ -61,6 +63,9 @@ class FileSystemTestOriginHelper {
const GURL& origin() const { return origin_; } const GURL& origin() const { return origin_; }
FileSystemType type() const { return type_; } FileSystemType type() const { return type_; }
quota::StorageType storage_type() const {
return FileSystemTypeToQuotaStorageType(type_);
}
FileSystemFileUtil* file_util() { return file_util_; } FileSystemFileUtil* file_util() { return file_util_; }
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment