| Index: content/browser/browser_context.cc
|
| ===================================================================
|
| --- content/browser/browser_context.cc (revision 127574)
|
| +++ content/browser/browser_context.cc (working copy)
|
| @@ -34,8 +34,6 @@
|
|
|
| namespace content {
|
|
|
| -namespace {
|
| -
|
| void CreateQuotaManagerAndClients(BrowserContext* context) {
|
| if (context->GetUserData(kQuotaManagerKeyName)) {
|
| DCHECK(context->GetUserData(kDatabaseTrackerKeyName));
|
| @@ -117,7 +115,9 @@
|
| }
|
|
|
| void SaveSessionStateOnWebkitThread(
|
| + scoped_refptr<DOMStorageContextImpl> dom_storage_context,
|
| scoped_refptr<IndexedDBContextImpl> indexed_db_context) {
|
| + dom_storage_context->SaveSessionState();
|
| indexed_db_context->SaveSessionState();
|
| }
|
|
|
| @@ -125,13 +125,11 @@
|
| ResourceContext::GetAppCacheService(resource_context)->PurgeMemory();
|
| }
|
|
|
| -DOMStorageContextImpl* GetDOMStorageContextImpl(BrowserContext* context) {
|
| - return static_cast<DOMStorageContextImpl*>(
|
| - BrowserContext::GetDOMStorageContext(context));
|
| +void PurgeMemoryOnWebkitThread(
|
| + scoped_refptr<DOMStorageContextImpl> dom_storage_context) {
|
| + dom_storage_context->PurgeMemory();
|
| }
|
|
|
| -} // namespace
|
| -
|
| QuotaManager* BrowserContext::GetQuotaManager(BrowserContext* context) {
|
| CreateQuotaManagerAndClients(context);
|
| return UserDataAdapter<QuotaManager>::Get(context, kQuotaManagerKeyName);
|
| @@ -190,20 +188,23 @@
|
| 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) {
|
| - GetDOMStorageContextImpl(browser_context)->SetClearLocalState(true);
|
| + DOMStorageContextImpl* dom_context = static_cast<DOMStorageContextImpl*>(
|
| + GetDOMStorageContext(browser_context));
|
| + dom_context->set_clear_local_state_on_exit(true);
|
|
|
| IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
|
| GetIndexedDBContext(browser_context));
|
| @@ -227,7 +228,14 @@
|
| browser_context->GetResourceContext()));
|
| }
|
|
|
| - GetDOMStorageContextImpl(browser_context)->PurgeMemory();
|
| + 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)));
|
| + }
|
| }
|
|
|
| BrowserContext::~BrowserContext() {
|
| @@ -240,10 +248,6 @@
|
| 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 =
|
| @@ -252,7 +256,6 @@
|
| BrowserThread::ReleaseSoon(
|
| BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, dom_storage_context);
|
| }
|
| -#endif
|
| }
|
|
|
| } // namespace content
|
|
|