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

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

Issue 11320018: Fixing guest processes to use the proper storage partition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing storage to be in-memory only. Created 8 years, 1 month 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/browser/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include "content/browser/fileapi/browser_file_system_helper.h" 7 #include "content/browser/fileapi/browser_file_system_helper.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "net/url_request/url_request_context_getter.h" 10 #include "net/url_request/url_request_context_getter.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // need 3 pieces of info from it. 88 // need 3 pieces of info from it.
89 StoragePartitionImpl* StoragePartitionImpl::Create( 89 StoragePartitionImpl* StoragePartitionImpl::Create(
90 BrowserContext* context, 90 BrowserContext* context,
91 const std::string& partition_id, 91 const std::string& partition_id,
92 const FilePath& profile_path) { 92 const FilePath& profile_path) {
93 // Ensure that these methods are called on the UI thread, except for 93 // Ensure that these methods are called on the UI thread, except for
94 // unittests where a UI thread might not have been created. 94 // unittests where a UI thread might not have been created.
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
96 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); 96 !BrowserThread::IsMessageLoopValid(BrowserThread::UI));
97 97
98 // The storage partition should be only in memory for guest processes
99 // and OTR profiles.
100 bool in_memory = (partition_id.find("guest-") != std::string::npos) ||
Charlie Reis 2012/10/27 00:48:27 Albert noted this shouldn't use find.
101 context->IsOffTheRecord();
Charlie Reis 2012/10/27 00:48:27 nit: Wrong indent.
102
98 FilePath partition_path = 103 FilePath partition_path =
99 profile_path.Append(GetPartitionPath(partition_id)); 104 profile_path.Append(GetPartitionPath(partition_id));
100 105
101 // All of the clients have to be created and registered with the 106 // All of the clients have to be created and registered with the
102 // QuotaManager prior to the QuotaManger being used. We do them 107 // QuotaManager prior to the QuotaManger being used. We do them
103 // all together here prior to handing out a reference to anything 108 // all together here prior to handing out a reference to anything
104 // that utilizes the QuotaManager. 109 // that utilizes the QuotaManager.
105 scoped_refptr<quota::QuotaManager> quota_manager = 110 scoped_refptr<quota::QuotaManager> quota_manager =
106 new quota::QuotaManager( 111 new quota::QuotaManager(
107 context->IsOffTheRecord(), partition_path, 112 in_memory, partition_path,
108 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 113 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
109 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 114 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
110 context->GetSpecialStoragePolicy()); 115 context->GetSpecialStoragePolicy());
111 116
112 // Each consumer is responsible for registering its QuotaClient during 117 // Each consumer is responsible for registering its QuotaClient during
113 // its construction. 118 // its construction.
114 scoped_refptr<fileapi::FileSystemContext> filesystem_context = 119 scoped_refptr<fileapi::FileSystemContext> filesystem_context =
115 CreateFileSystemContext(partition_path, context->IsOffTheRecord(), 120 CreateFileSystemContext(partition_path, in_memory,
116 context->GetSpecialStoragePolicy(), 121 context->GetSpecialStoragePolicy(),
117 quota_manager->proxy()); 122 quota_manager->proxy());
118 123
119 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = 124 scoped_refptr<webkit_database::DatabaseTracker> database_tracker =
120 new webkit_database::DatabaseTracker( 125 new webkit_database::DatabaseTracker(
121 partition_path, context->IsOffTheRecord(), 126 partition_path, in_memory,
122 context->GetSpecialStoragePolicy(), quota_manager->proxy(), 127 context->GetSpecialStoragePolicy(), quota_manager->proxy(),
123 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 128 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
124 129
125 FilePath path = context->IsOffTheRecord() ? FilePath() : partition_path; 130 FilePath path = in_memory ? FilePath() : partition_path;
126 scoped_refptr<DOMStorageContextImpl> dom_storage_context = 131 scoped_refptr<DOMStorageContextImpl> dom_storage_context =
127 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); 132 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy());
128 133
129 scoped_refptr<IndexedDBContextImpl> indexed_db_context = 134 scoped_refptr<IndexedDBContextImpl> indexed_db_context =
130 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), 135 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(),
131 quota_manager->proxy(), 136 quota_manager->proxy(),
132 BrowserThread::GetMessageLoopProxyForThread( 137 BrowserThread::GetMessageLoopProxyForThread(
133 BrowserThread::WEBKIT_DEPRECATED)); 138 BrowserThread::WEBKIT_DEPRECATED));
134 139
135 scoped_refptr<ChromeAppCacheService> appcache_service = 140 scoped_refptr<ChromeAppCacheService> appcache_service =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 net::URLRequestContextGetter* url_request_context) { 190 net::URLRequestContextGetter* url_request_context) {
186 url_request_context_ = url_request_context; 191 url_request_context_ = url_request_context;
187 } 192 }
188 193
189 void StoragePartitionImpl::SetMediaURLRequestContext( 194 void StoragePartitionImpl::SetMediaURLRequestContext(
190 net::URLRequestContextGetter* media_url_request_context) { 195 net::URLRequestContextGetter* media_url_request_context) {
191 media_url_request_context_ = media_url_request_context; 196 media_url_request_context_ = media_url_request_context;
192 } 197 }
193 198
194 } // namespace content 199 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698