summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authornoelutz@google.com <noelutz@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 16:32:24 +0000
committernoelutz@google.com <noelutz@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 16:32:24 +0000
commit0dcbc973f9f64c6eb645ccf2562692e8930a5e3f (patch)
treee1dac3486ff417dc0911362cb87329168b5dfed4 /chrome/browser
parent1d9d8af97b2bba1b0424410d280398a5d281a531 (diff)
downloadchromium_src-0dcbc973f9f64c6eb645ccf2562692e8930a5e3f.zip
chromium_src-0dcbc973f9f64c6eb645ccf2562692e8930a5e3f.tar.gz
chromium_src-0dcbc973f9f64c6eb645ccf2562692e8930a5e3f.tar.bz2
ContainsCsdWhitelistedUrl() is typically called on the IO thread.
Change the CHECK. BUG= TEST= Review URL: http://codereview.chromium.org/6719017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database.h2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_unittest.cc5
3 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index a56a5eb..2e5af5c 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/safe_browsing/bloom_filter.h"
#include "chrome/browser/safe_browsing/prefix_set.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
+#include "content/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
namespace {
@@ -651,8 +652,8 @@ bool SafeBrowsingDatabaseNew::ContainsDownloadHashPrefix(
bool SafeBrowsingDatabaseNew::ContainsCsdWhitelistedUrl(const GURL& url) {
// This method is theoretically thread-safe but we expect all calls to
- // originate from the creation thread.
- DCHECK_EQ(creation_loop_, MessageLoop::current());
+ // originate from the IO thread.
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::AutoLock l(lookup_lock_);
if (csd_whitelist_all_urls_)
return true;
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h
index 31abb99..48afd6a 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -103,7 +103,7 @@ class SafeBrowsingDatabase {
// Returns false if |url| is not on the client-side phishing detection
// whitelist. Otherwise, this function returns true. Note: the whitelist
// only contains full-length hashes so we don't return any prefix hit.
- // This function could ONLY be accessed from creation thread.
+ // This function should only be called from the IO thread.
virtual bool ContainsCsdWhitelistedUrl(const GURL& url) = 0;
// A database transaction should look like:
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index e05cc82..eeb4a9f 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_database.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h"
+#include "content/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -1187,6 +1188,10 @@ TEST_F(SafeBrowsingDatabaseTest, ContainsDownloadUrl) {
TEST_F(SafeBrowsingDatabaseTest, CsdWhitelist) {
database_.reset();
MessageLoop loop(MessageLoop::TYPE_DEFAULT);
+ // We expect all calls to ContainsCsdWhitelistedUrl to be made from the IO
+ // thread.
+ BrowserThread io_thread(BrowserThread::IO, &loop);
+
// If the whitelist is disabled everything should match the whitelist.
database_.reset(new SafeBrowsingDatabaseNew(new SafeBrowsingStoreFile(),
NULL, NULL));