summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornshkrob@chromium.org <nshkrob@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 16:23:05 +0000
committernshkrob@chromium.org <nshkrob@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 16:23:05 +0000
commit7c388781c4d85069c49b74784063b0da8b478c45 (patch)
tree9ceb7a734cee7a09b26b11b279dc4a36302f10a3
parent58b6433d5199d559185f04a49496fb7acbc8df79 (diff)
downloadchromium_src-7c388781c4d85069c49b74784063b0da8b478c45.zip
chromium_src-7c388781c4d85069c49b74784063b0da8b478c45.tar.gz
chromium_src-7c388781c4d85069c49b74784063b0da8b478c45.tar.bz2
Fix more races in TopSites: race on waiting_for_results_ and on top_sites_.size.
BUG=51890 TEST=tsan ui memory bot Review URL: http://codereview.chromium.org/3131015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56034 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/history/top_sites.cc19
-rw-r--r--tools/valgrind/tsan/suppressions.txt7
2 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index 07c4cf6..1a8e300 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -232,18 +232,18 @@ void TopSites::GetMostVisitedURLs(CancelableRequestConsumer* consumer,
// This ensures cancelation of requests when either the consumer or the
// provider is deleted. Deletion of requests is also guaranteed.
AddRequest(request, consumer);
- if (waiting_for_results_) {
- // A request came in before we have any top sites.
- // We have to keep track of the requests ourselves.
- pending_callbacks_.insert(request);
- return;
- }
- if (request->canceled())
- return;
-
MostVisitedURLList filtered_urls;
{
AutoLock lock(lock_);
+ if (waiting_for_results_) {
+ // A request came in before we have any top sites.
+ // We have to keep track of the requests ourselves.
+ pending_callbacks_.insert(request);
+ return;
+ }
+ if (request->canceled())
+ return;
+
ApplyBlacklistAndPinnedURLs(top_sites_, &filtered_urls);
}
request->ForwardResult(GetTopSitesCallback::TupleType(filtered_urls));
@@ -800,6 +800,7 @@ void TopSites::ClearProfile() {
}
base::TimeDelta TopSites::GetUpdateDelay() {
+ AutoLock lock(lock_);
if (top_sites_.size() == 0)
return base::TimeDelta::FromSeconds(30);
diff --git a/tools/valgrind/tsan/suppressions.txt b/tools/valgrind/tsan/suppressions.txt
index 5cd1933..2312114 100644
--- a/tools/valgrind/tsan/suppressions.txt
+++ b/tools/valgrind/tsan/suppressions.txt
@@ -32,13 +32,6 @@
fun:*media*PipelineImpl*GetCurrentTime*
}
-{
- bug_51890
- ThreadSanitizer:Race
- ...
- fun:history::TopSites::*
-}
-
############################
# Real races in third_party
{