OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_indexed_db_helper.h" | 5 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 CannedBrowsingDataIndexedDBHelper::CannedBrowsingDataIndexedDBHelper( | 203 CannedBrowsingDataIndexedDBHelper::CannedBrowsingDataIndexedDBHelper( |
204 Profile* profile) | 204 Profile* profile) |
205 : profile_(profile), | 205 : profile_(profile), |
206 completion_callback_(NULL), | 206 completion_callback_(NULL), |
207 is_fetching_(false) { | 207 is_fetching_(false) { |
208 DCHECK(profile); | 208 DCHECK(profile); |
209 } | 209 } |
210 | 210 |
| 211 CannedBrowsingDataIndexedDBHelper* CannedBrowsingDataIndexedDBHelper::Clone() { |
| 212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 213 CannedBrowsingDataIndexedDBHelper* clone = |
| 214 new CannedBrowsingDataIndexedDBHelper(profile_); |
| 215 |
| 216 base::AutoLock auto_lock(lock_); |
| 217 clone->pending_indexed_db_info_ = pending_indexed_db_info_; |
| 218 clone->indexed_db_info_ = indexed_db_info_; |
| 219 return clone; |
| 220 } |
| 221 |
211 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB( | 222 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB( |
212 const GURL& origin, const string16& description) { | 223 const GURL& origin, const string16& description) { |
213 base::AutoLock auto_lock(lock_); | 224 base::AutoLock auto_lock(lock_); |
214 pending_indexed_db_info_.push_back(PendingIndexedDBInfo(origin, description)); | 225 pending_indexed_db_info_.push_back(PendingIndexedDBInfo(origin, description)); |
215 } | 226 } |
216 | 227 |
217 void CannedBrowsingDataIndexedDBHelper::Reset() { | 228 void CannedBrowsingDataIndexedDBHelper::Reset() { |
218 base::AutoLock auto_lock(lock_); | 229 base::AutoLock auto_lock(lock_); |
219 indexed_db_info_.clear(); | 230 indexed_db_info_.clear(); |
220 pending_indexed_db_info_.clear(); | 231 pending_indexed_db_info_.clear(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 295 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
285 DCHECK(is_fetching_); | 296 DCHECK(is_fetching_); |
286 // Note: completion_callback_ mutates only in the UI thread, so it's safe to | 297 // Note: completion_callback_ mutates only in the UI thread, so it's safe to |
287 // test it here. | 298 // test it here. |
288 if (completion_callback_ != NULL) { | 299 if (completion_callback_ != NULL) { |
289 completion_callback_->Run(indexed_db_info_); | 300 completion_callback_->Run(indexed_db_info_); |
290 completion_callback_.reset(); | 301 completion_callback_.reset(); |
291 } | 302 } |
292 is_fetching_ = false; | 303 is_fetching_ = false; |
293 } | 304 } |
OLD | NEW |