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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_database.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 6304a39a87286aa5a92da4f495d83c41b2d944dd..f13d600f69c07ec23a8b2f8edde2021d3d632bed 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -422,7 +422,7 @@ void SafeBrowsingDatabase::RecordFailure(FailureType failure_type) {
}
SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew()
- : creation_loop_(MessageLoop::current()),
+ : creation_loop_(base::MessageLoop::current()),
browse_store_(new SafeBrowsingStoreFile),
download_store_(NULL),
csd_whitelist_store_(NULL),
@@ -443,7 +443,7 @@ SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew(
SafeBrowsingStore* csd_whitelist_store,
SafeBrowsingStore* download_whitelist_store,
SafeBrowsingStore* extension_blacklist_store)
- : creation_loop_(MessageLoop::current()),
+ : creation_loop_(base::MessageLoop::current()),
browse_store_(browse_store),
download_store_(download_store),
csd_whitelist_store_(csd_whitelist_store),
@@ -455,11 +455,11 @@ SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew(
}
SafeBrowsingDatabaseNew::~SafeBrowsingDatabaseNew() {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
}
void SafeBrowsingDatabaseNew::Init(const base::FilePath& filename_base) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
// Ensure we haven't been run before.
DCHECK(browse_filename_.empty());
DCHECK(download_filename_.empty());
@@ -543,7 +543,7 @@ void SafeBrowsingDatabaseNew::Init(const base::FilePath& filename_base) {
}
bool SafeBrowsingDatabaseNew::ResetDatabase() {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
// Delete files on disk.
// TODO(shess): Hard to see where one might want to delete without a
@@ -622,7 +622,7 @@ bool SafeBrowsingDatabaseNew::ContainsBrowseUrl(
bool SafeBrowsingDatabaseNew::ContainsDownloadUrl(
const std::vector<GURL>& urls,
std::vector<SBPrefix>* prefix_hits) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
// Ignore this check when download checking is not enabled.
if (!download_store_.get())
@@ -638,7 +638,7 @@ bool SafeBrowsingDatabaseNew::ContainsDownloadUrl(
bool SafeBrowsingDatabaseNew::ContainsDownloadHashPrefix(
const SBPrefix& prefix) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
// Ignore this check when download store is not available.
if (!download_store_.get())
@@ -669,7 +669,7 @@ bool SafeBrowsingDatabaseNew::ContainsDownloadWhitelistedUrl(const GURL& url) {
bool SafeBrowsingDatabaseNew::ContainsExtensionPrefixes(
const std::vector<SBPrefix>& prefixes,
std::vector<SBPrefix>* prefix_hits) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
if (!extension_blacklist_store_)
return false;
@@ -706,7 +706,7 @@ bool SafeBrowsingDatabaseNew::ContainsWhitelistedHashes(
// |entry| into the store.
void SafeBrowsingDatabaseNew::InsertAdd(int chunk_id, SBPrefix host,
const SBEntry* entry, int list_id) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
SafeBrowsingStore* store = GetStore(list_id);
if (!store) return;
@@ -748,7 +748,7 @@ void SafeBrowsingDatabaseNew::InsertAdd(int chunk_id, SBPrefix host,
void SafeBrowsingDatabaseNew::InsertAddChunks(
const safe_browsing_util::ListType list_id,
const SBChunkList& chunks) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
SafeBrowsingStore* store = GetStore(list_id);
if (!store) return;
@@ -777,7 +777,7 @@ void SafeBrowsingDatabaseNew::InsertAddChunks(
// |entry| into the store.
void SafeBrowsingDatabaseNew::InsertSub(int chunk_id, SBPrefix host,
const SBEntry* entry, int list_id) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
SafeBrowsingStore* store = GetStore(list_id);
if (!store) return;
@@ -823,7 +823,7 @@ void SafeBrowsingDatabaseNew::InsertSub(int chunk_id, SBPrefix host,
void SafeBrowsingDatabaseNew::InsertSubChunks(
safe_browsing_util::ListType list_id,
const SBChunkList& chunks) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
SafeBrowsingStore* store = GetStore(list_id);
if (!store) return;
@@ -848,7 +848,7 @@ void SafeBrowsingDatabaseNew::InsertSubChunks(
void SafeBrowsingDatabaseNew::InsertChunks(const std::string& list_name,
const SBChunkList& chunks) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
if (corruption_detected_ || chunks.empty())
return;
@@ -877,7 +877,7 @@ void SafeBrowsingDatabaseNew::InsertChunks(const std::string& list_name,
void SafeBrowsingDatabaseNew::DeleteChunks(
const std::vector<SBChunkDelete>& chunk_deletes) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
if (corruption_detected_ || chunk_deletes.empty())
return;
@@ -941,7 +941,7 @@ void SafeBrowsingDatabaseNew::CacheHashResults(
bool SafeBrowsingDatabaseNew::UpdateStarted(
std::vector<SBListChunkRanges>* lists) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
DCHECK(lists);
// If |BeginUpdate()| fails, reset the database.
@@ -1038,7 +1038,7 @@ bool SafeBrowsingDatabaseNew::UpdateStarted(
}
void SafeBrowsingDatabaseNew::UpdateFinished(bool update_succeeded) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
// The update may have failed due to corrupt storage (for instance,
// an excessive number of invalid add_chunks and sub_chunks).
@@ -1291,7 +1291,8 @@ void SafeBrowsingDatabaseNew::HandleCorruptDatabase() {
// reset once within the scope of a given task).
if (!reset_factory_.HasWeakPtrs()) {
RecordFailure(FAILURE_DATABASE_CORRUPT);
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SafeBrowsingDatabaseNew::OnHandleCorruptDatabase,
reset_factory_.GetWeakPtr()));
}
@@ -1307,7 +1308,7 @@ void SafeBrowsingDatabaseNew::OnHandleCorruptDatabase() {
// TODO(shess): I'm not clear why this code doesn't have any
// real error-handling.
void SafeBrowsingDatabaseNew::LoadPrefixSet() {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
DCHECK(!prefix_set_filename_.empty());
// If there is no database, the filter cannot be used.
@@ -1332,7 +1333,7 @@ void SafeBrowsingDatabaseNew::LoadPrefixSet() {
}
bool SafeBrowsingDatabaseNew::Delete() {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
const bool r1 = browse_store_->Delete();
if (!r1)
@@ -1370,7 +1371,7 @@ bool SafeBrowsingDatabaseNew::Delete() {
}
void SafeBrowsingDatabaseNew::WritePrefixSet() {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
if (!prefix_set_.get())
return;
@@ -1398,7 +1399,7 @@ void SafeBrowsingDatabaseNew::WhitelistEverything(SBWhitelist* whitelist) {
void SafeBrowsingDatabaseNew::LoadWhitelist(
const std::vector<SBAddFullHash>& full_hashes,
SBWhitelist* whitelist) {
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ DCHECK_EQ(creation_loop_, base::MessageLoop::current());
if (full_hashes.size() > kMaxWhitelistSize) {
WhitelistEverything(whitelist);
return;

Powered by Google App Engine
This is Rietveld 408576698