Index: chrome/browser/in_process_webkit/indexed_db_context.cc |
diff --git a/chrome/browser/in_process_webkit/indexed_db_context.cc b/chrome/browser/in_process_webkit/indexed_db_context.cc |
index 7f492ac563930143b584c4bc3142696a0ff5bfd9..61d94cf54071de8514dda058514f5c1f796e9dec 100644 |
--- a/chrome/browser/in_process_webkit/indexed_db_context.cc |
+++ b/chrome/browser/in_process_webkit/indexed_db_context.cc |
@@ -10,6 +10,7 @@ |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/browser_thread.h" |
#include "chrome/browser/in_process_webkit/webkit_context.h" |
+#include "chrome/common/url_constants.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebCString.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h" |
@@ -27,11 +28,16 @@ const FilePath::CharType IndexedDBContext::kIndexedDBDirectory[] = |
const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] = |
FILE_PATH_LITERAL(".indexeddb"); |
-IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context) |
- : webkit_context_(webkit_context) { |
+IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context) { |
+ data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory); |
} |
IndexedDBContext::~IndexedDBContext() { |
+ // Not being on the WEBKIT thread here means we are running in a unit test |
+ // where no clean up is needed. |
+ if (clear_local_state_on_exit_ && |
+ BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) |
+ ClearLocalState(data_path_, chrome::kExtensionScheme); |
jochen (gone - plz use gerrit)
2010/11/29 10:45:24
indent only two spaces. also, ClearLocalState does
pastarmovj
2010/11/29 12:50:37
Done.
|
} |
WebIDBFactory* IndexedDBContext::GetIDBFactory() { |
@@ -43,17 +49,14 @@ WebIDBFactory* IndexedDBContext::GetIDBFactory() { |
FilePath IndexedDBContext::GetIndexedDBFilePath( |
const string16& origin_id) const { |
- FilePath storage_dir = webkit_context_->data_path().Append( |
- kIndexedDBDirectory); |
FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id); |
- return storage_dir.Append(id.append(kIndexedDBExtension)); |
+ return data_path_; |
jochen (gone - plz use gerrit)
2010/11/29 10:45:24
this method should return the complete filename, n
pastarmovj
2010/11/29 12:50:37
Done. Sorry this was a mistake while I was cleanin
|
} |
-// static |
-void IndexedDBContext::ClearLocalState(const FilePath& profile_path, |
+void IndexedDBContext::ClearLocalState(const FilePath& indexeddb_path, |
const char* url_scheme_to_be_skipped) { |
- file_util::FileEnumerator file_enumerator(profile_path.Append( |
- kIndexedDBDirectory), false, file_util::FileEnumerator::FILES); |
+ file_util::FileEnumerator file_enumerator( |
+ indexeddb_path, false, file_util::FileEnumerator::FILES); |
// TODO(pastarmovj): We might need to consider exchanging this loop for |
// something more efficient in the future. |
for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); |