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

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

Issue 10879075: Shard DatabaseTracker (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 #include "content/browser/appcache/chrome_appcache_service.h" 7 #include "content/browser/appcache/chrome_appcache_service.h"
8 #include "webkit/database/database_tracker.h" 8 #include "webkit/database/database_tracker.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_file_manager.h" 10 #include "content/browser/download/download_file_manager.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 context, kDownloadManagerKeyName); 99 context, kDownloadManagerKeyName);
100 } 100 }
101 101
102 IndexedDBContext* BrowserContext::GetIndexedDBContext( 102 IndexedDBContext* BrowserContext::GetIndexedDBContext(
103 BrowserContext* browser_context) { 103 BrowserContext* browser_context) {
104 // TODO(ajwong): Change this API to require a SiteInstance instead of 104 // TODO(ajwong): Change this API to require a SiteInstance instead of
105 // using GetDefaultStoragePartition(). 105 // using GetDefaultStoragePartition().
106 return GetDefaultStoragePartition(browser_context)->GetIndexedDBContext(); 106 return GetDefaultStoragePartition(browser_context)->GetIndexedDBContext();
107 } 107 }
108 108
109 webkit_database::DatabaseTracker* BrowserContext::GetDatabaseTracker(
110 BrowserContext* browser_context) {
111 // TODO(ajwong): Change this API to require a SiteInstance instead of
112 // using GetDefaultStoragePartition().
113 return GetDefaultStoragePartition(browser_context)->GetDatabaseTracker();
114 }
115
116 appcache::AppCacheService* BrowserContext::GetAppCacheService( 109 appcache::AppCacheService* BrowserContext::GetAppCacheService(
117 BrowserContext* browser_context) { 110 BrowserContext* browser_context) {
118 // TODO(ajwong): Change this API to require a SiteInstance instead of 111 // TODO(ajwong): Change this API to require a SiteInstance instead of
119 // using GetDefaultStoragePartition(). 112 // using GetDefaultStoragePartition().
120 return GetDefaultStoragePartition(browser_context)->GetAppCacheService(); 113 return GetDefaultStoragePartition(browser_context)->GetAppCacheService();
121 } 114 }
122 115
123 fileapi::FileSystemContext* BrowserContext::GetFileSystemContext( 116 fileapi::FileSystemContext* BrowserContext::GetFileSystemContext(
124 BrowserContext* browser_context) { 117 BrowserContext* browser_context) {
125 // TODO(ajwong): Change this API to require a SiteInstance instead of 118 // TODO(ajwong): Change this API to require a SiteInstance instead of
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // ResourceContext::InitializeResourceContext() directly here is that 159 // ResourceContext::InitializeResourceContext() directly here is that
167 // ResourceContext initialization may call back into BrowserContext 160 // ResourceContext initialization may call back into BrowserContext
168 // and when that call returns it'll end rewriting its UserData map. It will 161 // and when that call returns it'll end rewriting its UserData map. It will
169 // end up rewriting the same value but this still causes a race condition. 162 // end up rewriting the same value but this still causes a race condition.
170 // 163 //
171 // See http://crbug.com/115678. 164 // See http://crbug.com/115678.
172 GetDefaultStoragePartition(context); 165 GetDefaultStoragePartition(context);
173 } 166 }
174 167
175 void BrowserContext::SaveSessionState(BrowserContext* browser_context) { 168 void BrowserContext::SaveSessionState(BrowserContext* browser_context) {
176 GetDatabaseTracker(browser_context)->SetForceKeepSessionState(); 169 GetDefaultStoragePartition(browser_context)->GetDatabaseTracker()->
awong 2012/08/27 21:11:25 Should this use the ForEachStoragePartiion and cal
michaeln 2012/08/27 22:09:57 For now, i've been avoiding putting behaviors rela
170 SetForceKeepSessionState();
177 171
178 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { 172 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
179 BrowserThread::PostTask( 173 BrowserThread::PostTask(
180 BrowserThread::IO, FROM_HERE, 174 BrowserThread::IO, FROM_HERE,
181 base::Bind(&SaveSessionStateOnIOThread, 175 base::Bind(&SaveSessionStateOnIOThread,
182 browser_context->GetResourceContext())); 176 browser_context->GetResourceContext()));
183 } 177 }
184 178
185 DOMStorageContextImpl* dom_storage_context_impl = 179 DOMStorageContextImpl* dom_storage_context_impl =
186 static_cast<DOMStorageContextImpl*>( 180 static_cast<DOMStorageContextImpl*>(
(...skipping 21 matching lines...) Expand all
208 ForEachStoragePartition(browser_context, 202 ForEachStoragePartition(browser_context,
209 base::Bind(&PurgeDOMStorageContextInPartition)); 203 base::Bind(&PurgeDOMStorageContextInPartition));
210 } 204 }
211 205
212 BrowserContext::~BrowserContext() { 206 BrowserContext::~BrowserContext() {
213 if (GetUserData(kDownloadManagerKeyName)) 207 if (GetUserData(kDownloadManagerKeyName))
214 GetDownloadManager(this)->Shutdown(); 208 GetDownloadManager(this)->Shutdown();
215 } 209 }
216 210
217 } // namespace content 211 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698