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

Unified Diff: content/browser/browser_context.cc

Issue 9695013: DOMStorageContextImpl that's implemented in terms of the new dom_storage classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_context_impl_new.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_context.cc
===================================================================
--- content/browser/browser_context.cc (revision 127221)
+++ content/browser/browser_context.cc (working copy)
@@ -34,6 +34,8 @@
namespace content {
+namespace {
+
void CreateQuotaManagerAndClients(BrowserContext* context) {
if (context->GetUserData(kQuotaManagerKeyName)) {
DCHECK(context->GetUserData(kDatabaseTrackerKeyName));
@@ -115,9 +117,7 @@
}
void SaveSessionStateOnWebkitThread(
- scoped_refptr<DOMStorageContextImpl> dom_storage_context,
scoped_refptr<IndexedDBContextImpl> indexed_db_context) {
- dom_storage_context->SaveSessionState();
indexed_db_context->SaveSessionState();
}
@@ -125,11 +125,13 @@
ResourceContext::GetAppCacheService(resource_context)->PurgeMemory();
}
-void PurgeMemoryOnWebkitThread(
- scoped_refptr<DOMStorageContextImpl> dom_storage_context) {
- dom_storage_context->PurgeMemory();
+DOMStorageContextImpl* GetDOMStorageContextImpl(BrowserContext* context) {
+ return static_cast<DOMStorageContextImpl*>(
+ BrowserContext::GetDOMStorageContext(context));
}
+} // namespace
+
QuotaManager* BrowserContext::GetQuotaManager(BrowserContext* context) {
CreateQuotaManagerAndClients(context);
return UserDataAdapter<QuotaManager>::Get(context, kQuotaManagerKeyName);
@@ -188,23 +190,20 @@
browser_context->GetResourceContext()));
}
+ GetDOMStorageContextImpl(browser_context)->SaveSessionState();
+
if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
- DOMStorageContextImpl* dom_context = static_cast<DOMStorageContextImpl*>(
- GetDOMStorageContext(browser_context));
IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
GetIndexedDBContext(browser_context));
BrowserThread::PostTask(
BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
base::Bind(&SaveSessionStateOnWebkitThread,
- make_scoped_refptr(dom_context),
make_scoped_refptr(indexed_db)));
}
}
void BrowserContext::ClearLocalOnDestruction(BrowserContext* browser_context) {
- DOMStorageContextImpl* dom_context = static_cast<DOMStorageContextImpl*>(
- GetDOMStorageContext(browser_context));
- dom_context->set_clear_local_state_on_exit(true);
+ GetDOMStorageContextImpl(browser_context)->SetClearLocalState(true);
IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
GetIndexedDBContext(browser_context));
@@ -228,14 +227,7 @@
browser_context->GetResourceContext()));
}
- if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
- DOMStorageContextImpl* dom_context = static_cast<DOMStorageContextImpl*>(
- GetDOMStorageContext(browser_context));
- BrowserThread::PostTask(
- BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
- base::Bind(&PurgeMemoryOnWebkitThread,
- make_scoped_refptr(dom_context)));
- }
+ GetDOMStorageContextImpl(browser_context)->PurgeMemory();
}
BrowserContext::~BrowserContext() {
@@ -248,6 +240,10 @@
GetDatabaseTracker(this)));
}
+#ifdef ENABLE_NEW_DOM_STORAGE_BACKEND
+ if (GetUserData(kDOMStorageContextKeyName))
+ GetDOMStorageContextImpl(this)->Shutdown();
+#else
if (GetUserData(kDOMStorageContextKeyName) &&
BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
DOMStorageContextImpl* dom_storage_context =
@@ -256,6 +252,7 @@
BrowserThread::ReleaseSoon(
BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, dom_storage_context);
}
+#endif
}
} // namespace content
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_context_impl_new.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698