summaryrefslogtreecommitdiffstats
path: root/webkit/quota
diff options
context:
space:
mode:
authorcalvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 08:26:57 +0000
committercalvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 08:26:57 +0000
commitc0f4a315eedd7b5b094239940267b5482a72697c (patch)
treed470ca8277dbf155e3d321e198116eb5aa4a9a9c /webkit/quota
parent6a144160dfb2945b0099071662d2dd392594a24f (diff)
downloadchromium_src-c0f4a315eedd7b5b094239940267b5482a72697c.zip
chromium_src-c0f4a315eedd7b5b094239940267b5482a72697c.tar.gz
chromium_src-c0f4a315eedd7b5b094239940267b5482a72697c.tar.bz2
Ensure profile path directory exists before trying to determine amount of free space.
BUG=153501 Review URL: https://chromiumcodereview.appspot.com/11189055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/quota')
-rw-r--r--webkit/quota/quota_manager.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc
index eccff6e..00c144c 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -14,6 +14,7 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/metrics/histogram.h"
@@ -150,6 +151,15 @@ bool UpdateModifiedTimeOnDBThread(const GURL& origin,
return database->SetOriginLastModifiedTime(origin, type, modified_time);
}
+int64 CallSystemGetAmountOfFreeDiskSpace(const FilePath& profile_path) {
+ // Ensure the profile path exists.
+ if(!file_util::CreateDirectory(profile_path)) {
+ LOG(WARNING) << "Create directory failed for path" << profile_path.value();
+ return 0;
+ }
+ return base::SysInfo::AmountOfFreeDiskSpace(profile_path);
+}
+
} // anonymous namespace
const int64 QuotaManager::kNoLimit = kint64max;
@@ -883,7 +893,7 @@ QuotaManager::QuotaManager(bool is_incognito,
desired_available_space_(-1),
special_storage_policy_(special_storage_policy),
weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- get_disk_space_fn_(&base::SysInfo::AmountOfFreeDiskSpace) {
+ get_disk_space_fn_(&CallSystemGetAmountOfFreeDiskSpace) {
}
void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) {