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 "content/browser/indexed_db/indexed_db_context_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 AddExtension(kIndexedDBExtension). | 311 AddExtension(kIndexedDBExtension). |
312 AddExtension(kLevelDBExtension); | 312 AddExtension(kLevelDBExtension); |
313 } | 313 } |
314 | 314 |
315 int64 IndexedDBContextImpl::ReadUsageFromDisk(const GURL& origin_url) const { | 315 int64 IndexedDBContextImpl::ReadUsageFromDisk(const GURL& origin_url) const { |
316 if (data_path_.empty()) | 316 if (data_path_.empty()) |
317 return 0; | 317 return 0; |
318 std::string origin_id = | 318 std::string origin_id = |
319 webkit_database::GetIdentifierFromOrigin(origin_url); | 319 webkit_database::GetIdentifierFromOrigin(origin_url); |
320 base::FilePath file_path = GetIndexedDBFilePath(origin_id); | 320 base::FilePath file_path = GetIndexedDBFilePath(origin_id); |
321 return file_util::ComputeDirectorySize(file_path); | 321 return base::ComputeDirectorySize(file_path); |
322 } | 322 } |
323 | 323 |
324 void IndexedDBContextImpl::EnsureDiskUsageCacheInitialized( | 324 void IndexedDBContextImpl::EnsureDiskUsageCacheInitialized( |
325 const GURL& origin_url) { | 325 const GURL& origin_url) { |
326 if (origin_size_map_.find(origin_url) == origin_size_map_.end()) | 326 if (origin_size_map_.find(origin_url) == origin_size_map_.end()) |
327 origin_size_map_[origin_url] = ReadUsageFromDisk(origin_url); | 327 origin_size_map_[origin_url] = ReadUsageFromDisk(origin_url); |
328 } | 328 } |
329 | 329 |
330 void IndexedDBContextImpl::QueryDiskAndUpdateQuotaUsage( | 330 void IndexedDBContextImpl::QueryDiskAndUpdateQuotaUsage( |
331 const GURL& origin_url) { | 331 const GURL& origin_url) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return origin_set_.get(); | 407 return origin_set_.get(); |
408 } | 408 } |
409 | 409 |
410 void IndexedDBContextImpl::ResetCaches() { | 410 void IndexedDBContextImpl::ResetCaches() { |
411 origin_set_.reset(); | 411 origin_set_.reset(); |
412 origin_size_map_.clear(); | 412 origin_size_map_.clear(); |
413 space_available_map_.clear(); | 413 space_available_map_.clear(); |
414 } | 414 } |
415 | 415 |
416 } // namespace content | 416 } // namespace content |
OLD | NEW |