OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/in_process_webkit/indexed_db_context.h" | 5 #include "chrome/browser/in_process_webkit/indexed_db_context.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 const FilePath::CharType IndexedDBContext::kIndexedDBDirectory[] = | 47 const FilePath::CharType IndexedDBContext::kIndexedDBDirectory[] = |
48 FILE_PATH_LITERAL("IndexedDB"); | 48 FILE_PATH_LITERAL("IndexedDB"); |
49 | 49 |
50 const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] = | 50 const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] = |
51 FILE_PATH_LITERAL(".indexeddb"); | 51 FILE_PATH_LITERAL(".indexeddb"); |
52 | 52 |
53 IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context) { | 53 IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context) |
| 54 : clear_local_state_on_exit_(false) { |
54 data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory); | 55 data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory); |
55 } | 56 } |
56 | 57 |
57 IndexedDBContext::~IndexedDBContext() { | 58 IndexedDBContext::~IndexedDBContext() { |
58 // Not being on the WEBKIT thread here means we are running in a unit test | 59 // Not being on the WEBKIT thread here means we are running in a unit test |
59 // where no clean up is needed. | 60 // where no clean up is needed. |
60 if (clear_local_state_on_exit_ && | 61 if (clear_local_state_on_exit_ && |
61 BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { | 62 BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { |
62 ClearLocalState(data_path_, chrome::kExtensionScheme); | 63 ClearLocalState(data_path_, chrome::kExtensionScheme); |
63 } | 64 } |
(...skipping 19 matching lines...) Expand all Loading... |
83 } | 84 } |
84 | 85 |
85 void IndexedDBContext::DeleteIndexedDBForOrigin(const string16& origin_id) { | 86 void IndexedDBContext::DeleteIndexedDBForOrigin(const string16& origin_id) { |
86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
87 // TODO(pastarmovj): Remove this check once we are safe to delete any time. | 88 // TODO(pastarmovj): Remove this check once we are safe to delete any time. |
88 FilePath idb_file = GetIndexedDBFilePath(origin_id); | 89 FilePath idb_file = GetIndexedDBFilePath(origin_id); |
89 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")), | 90 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")), |
90 FILE_PATH_LITERAL("chrome-extension")); | 91 FILE_PATH_LITERAL("chrome-extension")); |
91 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id)); | 92 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id)); |
92 } | 93 } |
OLD | NEW |