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

Side by Side Diff: webkit/browser/fileapi/file_system_context.cc

Issue 23545016: Not creating ClientUsageTracker for unsupported storage type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 partition_path, 114 partition_path,
115 special_storage_policy, 115 special_storage_policy,
116 options)), 116 options)),
117 sandbox_backend_(new SandboxFileSystemBackend( 117 sandbox_backend_(new SandboxFileSystemBackend(
118 sandbox_delegate_.get())), 118 sandbox_delegate_.get())),
119 isolated_backend_(new IsolatedFileSystemBackend()), 119 isolated_backend_(new IsolatedFileSystemBackend()),
120 additional_backends_(additional_backends.Pass()), 120 additional_backends_(additional_backends.Pass()),
121 external_mount_points_(external_mount_points), 121 external_mount_points_(external_mount_points),
122 partition_path_(partition_path), 122 partition_path_(partition_path),
123 operation_runner_(new FileSystemOperationRunner(this)) { 123 operation_runner_(new FileSystemOperationRunner(this)) {
124 if (quota_manager_proxy) {
125 quota_manager_proxy->RegisterClient(CreateQuotaClient(
126 this, options.is_incognito()));
127 }
128
129 RegisterBackend(sandbox_backend_.get()); 124 RegisterBackend(sandbox_backend_.get());
130 RegisterBackend(isolated_backend_.get()); 125 RegisterBackend(isolated_backend_.get());
131 126
132 for (ScopedVector<FileSystemBackend>::const_iterator iter = 127 for (ScopedVector<FileSystemBackend>::const_iterator iter =
133 additional_backends_.begin(); 128 additional_backends_.begin();
134 iter != additional_backends_.end(); ++iter) { 129 iter != additional_backends_.end(); ++iter) {
135 RegisterBackend(*iter); 130 RegisterBackend(*iter);
136 } 131 }
137 132
133 if (quota_manager_proxy) {
134 // Quota client assumes all backends have registered.
135 quota_manager_proxy->RegisterClient(CreateQuotaClient(
136 this, options.is_incognito()));
137 }
138
138 sandbox_backend_->Initialize(this); 139 sandbox_backend_->Initialize(this);
139 isolated_backend_->Initialize(this); 140 isolated_backend_->Initialize(this);
140 for (ScopedVector<FileSystemBackend>::const_iterator iter = 141 for (ScopedVector<FileSystemBackend>::const_iterator iter =
141 additional_backends_.begin(); 142 additional_backends_.begin();
142 iter != additional_backends_.end(); ++iter) { 143 iter != additional_backends_.end(); ++iter) {
143 (*iter)->Initialize(this); 144 (*iter)->Initialize(this);
144 } 145 }
145 146
146 // Additional mount points must be added before regular system-wide 147 // Additional mount points must be added before regular system-wide
147 // mount points. 148 // mount points.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 FileSystemBackend* FileSystemContext::GetFileSystemBackend( 224 FileSystemBackend* FileSystemContext::GetFileSystemBackend(
224 FileSystemType type) const { 225 FileSystemType type) const {
225 FileSystemBackendMap::const_iterator found = backend_map_.find(type); 226 FileSystemBackendMap::const_iterator found = backend_map_.find(type);
226 if (found != backend_map_.end()) 227 if (found != backend_map_.end())
227 return found->second; 228 return found->second;
228 NOTREACHED() << "Unknown filesystem type: " << type; 229 NOTREACHED() << "Unknown filesystem type: " << type;
229 return NULL; 230 return NULL;
230 } 231 }
231 232
232 bool FileSystemContext::IsSandboxFileSystem(FileSystemType type) const { 233 bool FileSystemContext::IsSandboxFileSystem(FileSystemType type) const {
233 return GetQuotaUtil(type) != NULL; 234 FileSystemBackendMap::const_iterator found = backend_map_.find(type);
235 return found != backend_map_.end() && found->second->GetQuotaUtil();
234 } 236 }
235 237
236 const UpdateObserverList* FileSystemContext::GetUpdateObservers( 238 const UpdateObserverList* FileSystemContext::GetUpdateObservers(
237 FileSystemType type) const { 239 FileSystemType type) const {
238 FileSystemBackend* backend = GetFileSystemBackend(type); 240 FileSystemBackend* backend = GetFileSystemBackend(type);
239 if (backend->GetQuotaUtil()) 241 if (backend->GetQuotaUtil())
240 return backend->GetQuotaUtil()->GetUpdateObservers(type); 242 return backend->GetQuotaUtil()->GetUpdateObservers(type);
241 return NULL; 243 return NULL;
242 } 244 }
243 245
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 FileSystemType type = static_cast<FileSystemType>(t); 441 FileSystemType type = static_cast<FileSystemType>(t);
440 if (backend->CanHandleType(type)) { 442 if (backend->CanHandleType(type)) {
441 const bool inserted = backend_map_.insert( 443 const bool inserted = backend_map_.insert(
442 std::make_pair(type, backend)).second; 444 std::make_pair(type, backend)).second;
443 DCHECK(inserted); 445 DCHECK(inserted);
444 } 446 }
445 } 447 }
446 } 448 }
447 449
448 } // namespace fileapi 450 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/database/database_quota_client.cc ('k') | webkit/browser/fileapi/file_system_quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698