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

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

Issue 10837230: Move StoragePartition into content/public and remove BrowserContext::GetDOMStorageContext(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove DISALLOW_COPY_AND_ASSIGN, and change RPH::CreateMessageFilters() to not suddenly isolate all… Created 8 years, 4 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
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/storage_partition_impl_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/storage_partition.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include "content/browser/appcache/chrome_appcache_service.h"
8 #include "content/browser/dom_storage/dom_storage_context_impl.h"
9 #include "content/browser/fileapi/browser_file_system_helper.h" 7 #include "content/browser/fileapi/browser_file_system_helper.h"
10 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
11 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
13 #include "webkit/database/database_tracker.h" 10 #include "webkit/database/database_tracker.h"
14 #include "webkit/quota/quota_manager.h" 11 #include "webkit/quota/quota_manager.h"
15 12
16 namespace content { 13 namespace content {
17 14
18 StoragePartition::StoragePartition( 15 StoragePartitionImpl::StoragePartitionImpl(
19 const FilePath& partition_path, 16 const FilePath& partition_path,
20 quota::QuotaManager* quota_manager, 17 quota::QuotaManager* quota_manager,
21 ChromeAppCacheService* appcache_service, 18 ChromeAppCacheService* appcache_service,
22 fileapi::FileSystemContext* filesystem_context, 19 fileapi::FileSystemContext* filesystem_context,
23 webkit_database::DatabaseTracker* database_tracker, 20 webkit_database::DatabaseTracker* database_tracker,
24 DOMStorageContextImpl* dom_storage_context, 21 DOMStorageContextImpl* dom_storage_context,
25 IndexedDBContext* indexed_db_context) 22 IndexedDBContextImpl* indexed_db_context)
26 : partition_path_(partition_path), 23 : partition_path_(partition_path),
27 quota_manager_(quota_manager), 24 quota_manager_(quota_manager),
28 appcache_service_(appcache_service), 25 appcache_service_(appcache_service),
29 filesystem_context_(filesystem_context), 26 filesystem_context_(filesystem_context),
30 database_tracker_(database_tracker), 27 database_tracker_(database_tracker),
31 dom_storage_context_(dom_storage_context), 28 dom_storage_context_(dom_storage_context),
32 indexed_db_context_(indexed_db_context) { 29 indexed_db_context_(indexed_db_context) {
33 } 30 }
34 31
35 StoragePartition::~StoragePartition() { 32 StoragePartitionImpl::~StoragePartitionImpl() {
36 // These message loop checks are just to avoid leaks in unittests. 33 // These message loop checks are just to avoid leaks in unittests.
37 if (database_tracker() && 34 if (GetDatabaseTracker() &&
38 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { 35 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) {
39 BrowserThread::PostTask( 36 BrowserThread::PostTask(
40 BrowserThread::FILE, FROM_HERE, 37 BrowserThread::FILE, FROM_HERE,
41 base::Bind(&webkit_database::DatabaseTracker::Shutdown, 38 base::Bind(&webkit_database::DatabaseTracker::Shutdown,
42 database_tracker())); 39 GetDatabaseTracker()));
43 } 40 }
44 41
45 if (dom_storage_context()) 42 if (GetDOMStorageContext())
46 dom_storage_context()->Shutdown(); 43 GetDOMStorageContext()->Shutdown();
47 } 44 }
48 45
49 // TODO(ajwong): Break the direct dependency on |context|. We only 46 // TODO(ajwong): Break the direct dependency on |context|. We only
50 // need 3 pieces of info from it. 47 // need 3 pieces of info from it.
51 StoragePartition* StoragePartition::Create(BrowserContext* context, 48 StoragePartitionImpl* StoragePartitionImpl::Create(
52 const FilePath& partition_path) { 49 BrowserContext* context,
50 const FilePath& partition_path) {
53 // Ensure that these methods are called on the UI thread, except for 51 // Ensure that these methods are called on the UI thread, except for
54 // unittests where a UI thread might not have been created. 52 // unittests where a UI thread might not have been created.
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
56 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); 54 !BrowserThread::IsMessageLoopValid(BrowserThread::UI));
57 55
58 // All of the clients have to be created and registered with the 56 // All of the clients have to be created and registered with the
59 // QuotaManager prior to the QuotaManger being used. We do them 57 // QuotaManager prior to the QuotaManger being used. We do them
60 // all together here prior to handing out a reference to anything 58 // all together here prior to handing out a reference to anything
61 // that utilizes the QuotaManager. 59 // that utilizes the QuotaManager.
62 scoped_refptr<quota::QuotaManager> quota_manager = 60 scoped_refptr<quota::QuotaManager> quota_manager =
(...skipping 22 matching lines...) Expand all
85 83
86 scoped_refptr<IndexedDBContextImpl> indexed_db_context = 84 scoped_refptr<IndexedDBContextImpl> indexed_db_context =
87 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), 85 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(),
88 quota_manager->proxy(), 86 quota_manager->proxy(),
89 BrowserThread::GetMessageLoopProxyForThread( 87 BrowserThread::GetMessageLoopProxyForThread(
90 BrowserThread::WEBKIT_DEPRECATED)); 88 BrowserThread::WEBKIT_DEPRECATED));
91 89
92 scoped_refptr<ChromeAppCacheService> appcache_service = 90 scoped_refptr<ChromeAppCacheService> appcache_service =
93 new ChromeAppCacheService(quota_manager->proxy()); 91 new ChromeAppCacheService(quota_manager->proxy());
94 92
95 return new StoragePartition(partition_path, 93 return new StoragePartitionImpl(partition_path,
96 quota_manager, 94 quota_manager,
97 appcache_service, 95 appcache_service,
98 filesystem_context, 96 filesystem_context,
99 database_tracker, 97 database_tracker,
100 dom_storage_context, 98 dom_storage_context,
101 indexed_db_context); 99 indexed_db_context);
100 }
101
102 quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() {
103 return quota_manager_;
104 }
105
106 ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() {
107 return appcache_service_;
108 }
109
110 fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() {
111 return filesystem_context_;
112 }
113
114 webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() {
115 return database_tracker_;
116 }
117
118 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() {
119 return dom_storage_context_;
120 }
121
122 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() {
123 return indexed_db_context_;
102 } 124 }
103 125
104 } // namespace content 126 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/storage_partition_impl_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698