OLD | NEW |
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 "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // static | 187 // static |
188 BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create( | 188 BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create( |
189 storage::FileSystemContext* filesystem_context) { | 189 storage::FileSystemContext* filesystem_context) { |
190 return new BrowsingDataFileSystemHelperImpl(filesystem_context); | 190 return new BrowsingDataFileSystemHelperImpl(filesystem_context); |
191 } | 191 } |
192 | 192 |
193 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper( | 193 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper( |
194 Profile* profile) { | 194 Profile* profile) { |
195 } | 195 } |
196 | 196 |
197 CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper() { | |
198 } | |
199 | |
200 CannedBrowsingDataFileSystemHelper::~CannedBrowsingDataFileSystemHelper() {} | 197 CannedBrowsingDataFileSystemHelper::~CannedBrowsingDataFileSystemHelper() {} |
201 | 198 |
202 CannedBrowsingDataFileSystemHelper* | |
203 CannedBrowsingDataFileSystemHelper::Clone() { | |
204 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
205 CannedBrowsingDataFileSystemHelper* clone = | |
206 new CannedBrowsingDataFileSystemHelper(); | |
207 // This list only mutates on the UI thread, so it's safe to work with it here | |
208 // (given the DCHECK above). | |
209 clone->file_system_info_ = file_system_info_; | |
210 return clone; | |
211 } | |
212 | |
213 void CannedBrowsingDataFileSystemHelper::AddFileSystem( | 199 void CannedBrowsingDataFileSystemHelper::AddFileSystem( |
214 const GURL& origin, | 200 const GURL& origin, |
215 const storage::FileSystemType type, | 201 const storage::FileSystemType type, |
216 const int64 size) { | 202 const int64 size) { |
217 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 203 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
218 // This canned implementation of AddFileSystem uses an O(n^2) algorithm; which | 204 // This canned implementation of AddFileSystem uses an O(n^2) algorithm; which |
219 // is fine, as it isn't meant for use in a high-volume context. If it turns | 205 // is fine, as it isn't meant for use in a high-volume context. If it turns |
220 // out that we want to start using this in a context with many, many origins, | 206 // out that we want to start using this in a context with many, many origins, |
221 // we should think about reworking the implementation. | 207 // we should think about reworking the implementation. |
222 bool duplicate_origin = false; | 208 bool duplicate_origin = false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 241 } |
256 | 242 |
257 void CannedBrowsingDataFileSystemHelper::StartFetching( | 243 void CannedBrowsingDataFileSystemHelper::StartFetching( |
258 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) { | 244 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) { |
259 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 245 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
260 DCHECK(!callback.is_null()); | 246 DCHECK(!callback.is_null()); |
261 | 247 |
262 BrowserThread::PostTask( | 248 BrowserThread::PostTask( |
263 BrowserThread::UI, FROM_HERE, base::Bind(callback, file_system_info_)); | 249 BrowserThread::UI, FROM_HERE, base::Bind(callback, file_system_info_)); |
264 } | 250 } |
OLD | NEW |