| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_database_helper.h" | 5 #include "chrome/browser/browsing_data_database_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod( | 80 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod( |
| 81 this, &BrowsingDataDatabaseHelper::NotifyInUIThread)); | 81 this, &BrowsingDataDatabaseHelper::NotifyInUIThread)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void BrowsingDataDatabaseHelper::NotifyInUIThread() { | 84 void BrowsingDataDatabaseHelper::NotifyInUIThread() { |
| 85 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 85 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 86 DCHECK(is_fetching_); | 86 DCHECK(is_fetching_); |
| 87 // Note: completion_callback_ mutates only in the UI thread, so it's safe to | 87 // Note: completion_callback_ mutates only in the UI thread, so it's safe to |
| 88 // test it here. | 88 // test it here. |
| 89 if (completion_callback_ != NULL) | 89 if (completion_callback_ != NULL) { |
| 90 completion_callback_->Run(database_info_); | 90 completion_callback_->Run(database_info_); |
| 91 completion_callback_.reset(); |
| 92 } |
| 91 is_fetching_ = false; | 93 is_fetching_ = false; |
| 92 database_info_.clear(); | 94 database_info_.clear(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 void BrowsingDataDatabaseHelper::DeleteDatabaseInFileThread( | 97 void BrowsingDataDatabaseHelper::DeleteDatabaseInFileThread( |
| 96 const std::string& origin, | 98 const std::string& origin, |
| 97 const std::string& name) { | 99 const std::string& name) { |
| 98 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); | 100 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); |
| 99 if (!tracker_.get()) | 101 if (!tracker_.get()) |
| 100 return; | 102 return; |
| 101 tracker_->DeleteDatabase(UTF8ToUTF16(origin), UTF8ToUTF16(name), NULL); | 103 tracker_->DeleteDatabase(UTF8ToUTF16(origin), UTF8ToUTF16(name), NULL); |
| 102 } | 104 } |
| OLD | NEW |