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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_enumerator.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "content/browser/indexed_db/indexed_db_quota_client.h" | 17 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
17 #include "content/browser/indexed_db/webidbfactory_impl.h" | 18 #include "content/browser/indexed_db/webidbfactory_impl.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/indexed_db_info.h" | 20 #include "content/public/browser/indexed_db_info.h" |
20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
21 #include "third_party/WebKit/public/platform/WebCString.h" | 22 #include "third_party/WebKit/public/platform/WebCString.h" |
(...skipping 18 matching lines...) Expand all Loading... |
40 FILE_PATH_LITERAL(".leveldb"); | 41 FILE_PATH_LITERAL(".leveldb"); |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
44 void GetAllOriginsAndPaths(const base::FilePath& indexeddb_path, | 45 void GetAllOriginsAndPaths(const base::FilePath& indexeddb_path, |
45 std::vector<GURL>* origins, | 46 std::vector<GURL>* origins, |
46 std::vector<base::FilePath>* file_paths) { | 47 std::vector<base::FilePath>* file_paths) { |
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
48 if (indexeddb_path.empty()) | 49 if (indexeddb_path.empty()) |
49 return; | 50 return; |
50 file_util::FileEnumerator file_enumerator( | 51 base::FileEnumerator file_enumerator( |
51 indexeddb_path, false, file_util::FileEnumerator::DIRECTORIES); | 52 indexeddb_path, false, base::FileEnumerator::DIRECTORIES); |
52 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); | 53 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); |
53 file_path = file_enumerator.Next()) { | 54 file_path = file_enumerator.Next()) { |
54 if (file_path.Extension() == IndexedDBContextImpl::kIndexedDBExtension) { | 55 if (file_path.Extension() == IndexedDBContextImpl::kIndexedDBExtension) { |
55 WebKit::WebString origin_id_webstring = | 56 WebKit::WebString origin_id_webstring = |
56 webkit_base::FilePathToWebString(file_path.BaseName()); | 57 webkit_base::FilePathToWebString(file_path.BaseName()); |
57 origins->push_back( | 58 origins->push_back( |
58 webkit_base::GetOriginURLFromIdentifier(origin_id_webstring)); | 59 webkit_base::GetOriginURLFromIdentifier(origin_id_webstring)); |
59 if (file_paths) | 60 if (file_paths) |
60 file_paths->push_back(file_path); | 61 file_paths->push_back(file_path); |
61 } | 62 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return origin_set_.get(); | 408 return origin_set_.get(); |
408 } | 409 } |
409 | 410 |
410 void IndexedDBContextImpl::ResetCaches() { | 411 void IndexedDBContextImpl::ResetCaches() { |
411 origin_set_.reset(); | 412 origin_set_.reset(); |
412 origin_size_map_.clear(); | 413 origin_size_map_.clear(); |
413 space_available_map_.clear(); | 414 space_available_map_.clear(); |
414 } | 415 } |
415 | 416 |
416 } // namespace content | 417 } // namespace content |
OLD | NEW |