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

Side by Side Diff: content/browser/browser_context.cc

Issue 17518004: Move IndexedDB from WEBKIT_DEPRECATED to dedicated thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/browser/browser_context.h" 5 #include "content/public/browser/browser_context.h"
6 6
7 #if !defined(OS_IOS) 7 #if !defined(OS_IOS)
8 #include "content/browser/appcache/chrome_appcache_service.h" 8 #include "content/browser/appcache/chrome_appcache_service.h"
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" 9 #include "content/browser/dom_storage/dom_storage_context_impl.h"
10 #include "content/browser/download/download_manager_impl.h" 10 #include "content/browser/download/download_manager_impl.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const scoped_refptr<net::URLRequestContextGetter>& context_getter, 75 const scoped_refptr<net::URLRequestContextGetter>& context_getter,
76 appcache::AppCacheService* appcache_service) { 76 appcache::AppCacheService* appcache_service) {
77 net::URLRequestContext* context = context_getter->GetURLRequestContext(); 77 net::URLRequestContext* context = context_getter->GetURLRequestContext();
78 context->cookie_store()->GetCookieMonster()-> 78 context->cookie_store()->GetCookieMonster()->
79 SetForceKeepSessionState(); 79 SetForceKeepSessionState();
80 context->server_bound_cert_service()->GetCertStore()-> 80 context->server_bound_cert_service()->GetCertStore()->
81 SetForceKeepSessionState(); 81 SetForceKeepSessionState();
82 appcache_service->set_force_keep_session_state(); 82 appcache_service->set_force_keep_session_state();
83 } 83 }
84 84
85 void SaveSessionStateOnWebkitThread( 85 void SaveSessionStateOnIndexedDBThread(
86 scoped_refptr<IndexedDBContextImpl> indexed_db_context) { 86 scoped_refptr<IndexedDBContextImpl> indexed_db_context) {
87 indexed_db_context->SetForceKeepSessionState(); 87 indexed_db_context->SetForceKeepSessionState();
88 } 88 }
89 89
90 void PurgeMemoryOnIOThread(appcache::AppCacheService* appcache_service) { 90 void PurgeMemoryOnIOThread(appcache::AppCacheService* appcache_service) {
91 appcache_service->PurgeMemory(); 91 appcache_service->PurgeMemory();
92 } 92 }
93 93
94 } // namespace 94 } // namespace
95 95
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 &SaveSessionStateOnIOThread, 231 &SaveSessionStateOnIOThread,
232 make_scoped_refptr(browser_context->GetRequestContext()), 232 make_scoped_refptr(browser_context->GetRequestContext()),
233 storage_partition->GetAppCacheService())); 233 storage_partition->GetAppCacheService()));
234 } 234 }
235 235
236 DOMStorageContextImpl* dom_storage_context_impl = 236 DOMStorageContextImpl* dom_storage_context_impl =
237 static_cast<DOMStorageContextImpl*>( 237 static_cast<DOMStorageContextImpl*>(
238 storage_partition->GetDOMStorageContext()); 238 storage_partition->GetDOMStorageContext());
239 dom_storage_context_impl->SetForceKeepSessionState(); 239 dom_storage_context_impl->SetForceKeepSessionState();
240 240
241 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) { 241 IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
242 IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
243 storage_partition->GetIndexedDBContext()); 242 storage_partition->GetIndexedDBContext());
244 BrowserThread::PostTask( 243 indexed_db->TaskRunner()->PostTask(
245 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, 244 FROM_HERE,
246 base::Bind(&SaveSessionStateOnWebkitThread, 245 base::Bind(&SaveSessionStateOnIndexedDBThread,
247 make_scoped_refptr(indexed_db))); 246 make_scoped_refptr(indexed_db)));
248 }
249 } 247 }
250 248
251 void BrowserContext::PurgeMemory(BrowserContext* browser_context) { 249 void BrowserContext::PurgeMemory(BrowserContext* browser_context) {
252 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { 250 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
253 BrowserThread::PostTask( 251 BrowserThread::PostTask(
254 BrowserThread::IO, FROM_HERE, 252 BrowserThread::IO, FROM_HERE,
255 base::Bind( 253 base::Bind(
256 &PurgeMemoryOnIOThread, 254 &PurgeMemoryOnIOThread,
257 BrowserContext::GetDefaultStoragePartition(browser_context)-> 255 BrowserContext::GetDefaultStoragePartition(browser_context)->
258 GetAppCacheService())); 256 GetAppCacheService()));
259 } 257 }
260 258
261 ForEachStoragePartition(browser_context, 259 ForEachStoragePartition(browser_context,
262 base::Bind(&PurgeDOMStorageContextInPartition)); 260 base::Bind(&PurgeDOMStorageContextInPartition));
263 } 261 }
264 262
265 #endif // !OS_IOS 263 #endif // !OS_IOS
266 264
267 BrowserContext::~BrowserContext() { 265 BrowserContext::~BrowserContext() {
268 #if !defined(OS_IOS) 266 #if !defined(OS_IOS)
269 if (GetUserData(kDownloadManagerKeyName)) 267 if (GetUserData(kDownloadManagerKeyName))
270 GetDownloadManager(this)->Shutdown(); 268 GetDownloadManager(this)->Shutdown();
271 #endif 269 #endif
272 } 270 }
273 271
274 } // namespace content 272 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698