Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1429)

Unified Diff: chrome/browser/in_process_webkit/indexed_db_context.cc

Issue 5359005: Moved deleting the indexed db context to the WebKitContext destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up static modifer from the ClearLocalState method. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698