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/fileapi/sandbox_quota_observer.h" | 5 #include "webkit/fileapi/sandbox_quota_observer.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "webkit/fileapi/file_system_url.h" | 8 #include "webkit/fileapi/file_system_url.h" |
9 #include "webkit/fileapi/file_system_usage_cache.h" | 9 #include "webkit/fileapi/file_system_usage_cache.h" |
10 #include "webkit/fileapi/file_system_util.h" | 10 #include "webkit/fileapi/file_system_util.h" |
11 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 11 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
12 #include "webkit/quota/quota_client.h" | 12 #include "webkit/quota/quota_client.h" |
13 #include "webkit/quota/quota_manager.h" | 13 #include "webkit/quota/quota_manager.h" |
14 | 14 |
15 namespace fileapi { | 15 namespace fileapi { |
16 | 16 |
17 SandboxQuotaObserver::SandboxQuotaObserver( | 17 SandboxQuotaObserver::SandboxQuotaObserver( |
18 quota::QuotaManagerProxy* quota_manager_proxy, | 18 quota::QuotaManagerProxy* quota_manager_proxy, |
19 base::SequencedTaskRunner* update_notify_runner, | 19 base::SequencedTaskRunner* update_notify_runner, |
20 ObfuscatedFileUtil* sandbox_file_util, | 20 ObfuscatedFileUtil* sandbox_file_util, |
21 FileSystemUsageCache* file_system_usage_cache) | 21 FileSystemUsageCache* file_system_usage_cache) |
22 : quota_manager_proxy_(quota_manager_proxy), | 22 : quota_manager_proxy_(quota_manager_proxy), |
23 update_notify_runner_(update_notify_runner), | 23 update_notify_runner_(update_notify_runner), |
24 sandbox_file_util_(sandbox_file_util), | 24 sandbox_file_util_(sandbox_file_util), |
25 file_system_usage_cache_(file_system_usage_cache), | 25 file_system_usage_cache_(file_system_usage_cache), |
26 running_delayed_cache_update_(false), | 26 running_delayed_cache_update_(false), |
27 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} | 27 weak_factory_(this) {} |
28 | 28 |
29 SandboxQuotaObserver::~SandboxQuotaObserver() {} | 29 SandboxQuotaObserver::~SandboxQuotaObserver() {} |
30 | 30 |
31 void SandboxQuotaObserver::OnStartUpdate(const FileSystemURL& url) { | 31 void SandboxQuotaObserver::OnStartUpdate(const FileSystemURL& url) { |
32 DCHECK(SandboxMountPointProvider::IsSandboxType(url.type())); | 32 DCHECK(SandboxMountPointProvider::IsSandboxType(url.type())); |
33 DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); | 33 DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); |
34 base::FilePath usage_file_path = GetUsageCachePath(url); | 34 base::FilePath usage_file_path = GetUsageCachePath(url); |
35 if (usage_file_path.empty()) | 35 if (usage_file_path.empty()) |
36 return; | 36 return; |
37 file_system_usage_cache_->IncrementDirty(usage_file_path); | 37 file_system_usage_cache_->IncrementDirty(usage_file_path); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void SandboxQuotaObserver::UpdateUsageCacheFile( | 132 void SandboxQuotaObserver::UpdateUsageCacheFile( |
133 const base::FilePath& usage_file_path, | 133 const base::FilePath& usage_file_path, |
134 int64 delta) { | 134 int64 delta) { |
135 DCHECK(!usage_file_path.empty()); | 135 DCHECK(!usage_file_path.empty()); |
136 if (!usage_file_path.empty() && delta != 0) | 136 if (!usage_file_path.empty() && delta != 0) |
137 file_system_usage_cache_->AtomicUpdateUsageByDelta(usage_file_path, delta); | 137 file_system_usage_cache_->AtomicUpdateUsageByDelta(usage_file_path, delta); |
138 } | 138 } |
139 | 139 |
140 } // namespace fileapi | 140 } // namespace fileapi |
OLD | NEW |