summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authornshkrob@chromium.org <nshkrob@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 20:38:49 +0000
committernshkrob@chromium.org <nshkrob@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 20:38:49 +0000
commit01a5190d878a4d55c8d9b7da2a33f699b5acf6e1 (patch)
tree38844ec8b0e1c85c397bd652c44861f9ef67a2d8 /chrome/browser/history
parenta015f9d29bdf73788a620fee73120022b7fa4a71 (diff)
downloadchromium_src-01a5190d878a4d55c8d9b7da2a33f699b5acf6e1.zip
chromium_src-01a5190d878a4d55c8d9b7da2a33f699b5acf6e1.tar.gz
chromium_src-01a5190d878a4d55c8d9b7da2a33f699b5acf6e1.tar.bz2
Fix race conditions in TopSites.
BUG=51890 TEST=tsan ui_tests Review URL: http://codereview.chromium.org/3158010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/top_sites.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index d1b349c..595761d 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -120,6 +120,7 @@ void TopSites::ReadDatabase() {
bool TopSites::SetPageThumbnail(const GURL& url,
const SkBitmap& thumbnail,
const ThumbnailScore& score) {
+ AutoLock lock(lock_);
bool add_temp_thumbnail = false;
if (canonical_urls_.find(url) == canonical_urls_.end()) {
if (top_sites_.size() < kTopSitesNumber) {
@@ -148,7 +149,6 @@ bool TopSites::SetPageThumbnail(const GURL& url,
return true;
}
- AutoLock lock(lock_);
return SetPageThumbnailEncoded(url, thumbnail_data, score);
}
@@ -607,6 +607,7 @@ void TopSites::StoreMostVisited(MostVisitedURLList* most_visited) {
void TopSites::StoreRedirectChain(const RedirectList& redirects,
size_t destination) {
+ lock_.AssertAcquired();
if (redirects.empty()) {
NOTREACHED();
return;
@@ -871,8 +872,8 @@ void TopSites::SetMockHistoryService(MockHistoryService* mhs) {
void TopSites::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
+ AutoLock lock(lock_);
if (type == NotificationType::HISTORY_URLS_DELETED) {
- AutoLock lock(lock_);
Details<history::URLsDeletedDetails> deleted_details(details);
if (deleted_details->all_history) {
top_sites_.clear();
@@ -907,7 +908,6 @@ void TopSites::Observe(NotificationType type,
GURL url = load_details->entry->url();
if (canonical_urls_.find(url) == canonical_urls_.end() &&
HistoryService::CanAddURL(url)) {
- AutoLock lock(lock_);
// Add this page to the known pages in case the thumbnail comes
// in before we get the results.
MostVisitedURL mv;