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