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

Unified Diff: webkit/fileapi/quota_file_util.h

Issue 7312023: Refactoring: Change all -FileUtils non-Singleton and to own underlying FileUtils. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments and rebased. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/obfuscated_file_system_file_util_unittest.cc ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/quota_file_util.h
diff --git a/webkit/fileapi/quota_file_util.h b/webkit/fileapi/quota_file_util.h
index e7fc2d7c266b0dfa5ee1a306a8cf70a9acc53d36..9a5b1a50e59eca48fb03e552fb4283b96a48442b 100644
--- a/webkit/fileapi/quota_file_util.h
+++ b/webkit/fileapi/quota_file_util.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
#define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
+#include "base/memory/scoped_ptr.h"
#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_context.h"
#pragma once
@@ -13,11 +14,17 @@ namespace fileapi {
class QuotaFileUtil : public FileSystemFileUtil {
public:
- static QuotaFileUtil* GetInstance();
- virtual ~QuotaFileUtil() {}
-
static const int64 kNoLimit;
kinuko 2011/07/26 09:48:57 style-nit: place variables after methods
Dai Mikurube (NOT FULLTIME) 2011/07/26 10:19:11 I remember Constants (static const) are better to
+ // |underlying_file_util| is owned by the instance. It will be deleted by
+ // the owner instance. For example, it can be instanciated as follows:
+ // FileSystemFileUtil* file_system_file_util =
+ // new QuotaFileUtil(new FileSystemFileUtil());
+ explicit QuotaFileUtil(FileSystemFileUtil* underlying_file_util);
+ virtual ~QuotaFileUtil();
+
+ static QuotaFileUtil* CreateDefault();
kinuko 2011/07/26 09:48:57 Please add comment about what this does. The comm
Dai Mikurube (NOT FULLTIME) 2011/07/26 10:19:11 Done.
+
// TODO(dmikurube): Make this function variable by the constructor.
int64 ComputeFilePathCost(const FilePath& file_path) const;
@@ -56,13 +63,9 @@ class QuotaFileUtil : public FileSystemFileUtil {
const FilePath& path,
int64 length) OVERRIDE;
- friend struct DefaultSingletonTraits<QuotaFileUtil>;
- DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);
-
- protected:
- QuotaFileUtil() {}
-
private:
+ scoped_ptr<FileSystemFileUtil> underlying_file_util_;
+
// TODO(dmikurube): Make these constants variable by the constructor.
//
// These values are based on Obfuscation DB. See crbug.com/86114 for the
@@ -81,6 +84,8 @@ class QuotaFileUtil : public FileSystemFileUtil {
const FilePath& dest_file_path,
int64 allowed_bytes_growth,
int64* growth) const;
+
+ DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);
};
} // namespace fileapi
« no previous file with comments | « webkit/fileapi/obfuscated_file_system_file_util_unittest.cc ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698