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" | |
13 #include "base/logging.h" | 12 #include "base/logging.h" |
14 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
15 #include "base/string_util.h" | 14 #include "base/string_util.h" |
16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
17 #include "content/browser/indexed_db/indexed_db_quota_client.h" | 16 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/indexed_db_info.h" | 18 #include "content/public/browser/indexed_db_info.h" |
20 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" |
22 #include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabase.h" | 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebIDBDatabase.h" |
(...skipping 17 matching lines...) Expand all Loading... |
40 | 39 |
41 namespace { | 40 namespace { |
42 | 41 |
43 void GetAllOriginsAndPaths( | 42 void GetAllOriginsAndPaths( |
44 const base::FilePath& indexeddb_path, | 43 const base::FilePath& indexeddb_path, |
45 std::vector<GURL>* origins, | 44 std::vector<GURL>* origins, |
46 std::vector<base::FilePath>* file_paths) { | 45 std::vector<base::FilePath>* file_paths) { |
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
48 if (indexeddb_path.empty()) | 47 if (indexeddb_path.empty()) |
49 return; | 48 return; |
50 base::FileEnumerator file_enumerator(indexeddb_path, | 49 file_util::FileEnumerator file_enumerator(indexeddb_path, |
51 false, base::FileEnumerator::DIRECTORIES); | 50 false, file_util::FileEnumerator::DIRECTORIES); |
52 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); | 51 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); |
53 file_path = file_enumerator.Next()) { | 52 file_path = file_enumerator.Next()) { |
54 if (file_path.Extension() == IndexedDBContextImpl::kIndexedDBExtension) { | 53 if (file_path.Extension() == IndexedDBContextImpl::kIndexedDBExtension) { |
55 WebKit::WebString origin_id_webstring = | 54 WebKit::WebString origin_id_webstring = |
56 webkit_base::FilePathToWebString(file_path.BaseName()); | 55 webkit_base::FilePathToWebString(file_path.BaseName()); |
57 origins->push_back( | 56 origins->push_back( |
58 DatabaseUtil::GetOriginFromIdentifier(origin_id_webstring)); | 57 DatabaseUtil::GetOriginFromIdentifier(origin_id_webstring)); |
59 if (file_paths) | 58 if (file_paths) |
60 file_paths->push_back(file_path); | 59 file_paths->push_back(file_path); |
61 } | 60 } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return origin_set_.get(); | 391 return origin_set_.get(); |
393 } | 392 } |
394 | 393 |
395 void IndexedDBContextImpl::ResetCaches() { | 394 void IndexedDBContextImpl::ResetCaches() { |
396 origin_set_.reset(); | 395 origin_set_.reset(); |
397 origin_size_map_.clear(); | 396 origin_size_map_.clear(); |
398 space_available_map_.clear(); | 397 space_available_map_.clear(); |
399 } | 398 } |
400 | 399 |
401 } // namespace content | 400 } // namespace content |
OLD | NEW |