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

Issue 7044059: [Sync] Ensure all accesses to SyncInternal's observers are thread safe. (Closed)

Created:
9 years, 6 months ago by Nicolas Zea
Modified:
9 years, 6 months ago
CC:
chromium-reviews, ncarter (slow), idana, Raghu Simha, Timur Iskhodzhanov, Alexander Potapenko, pam+watch_chromium.org, stuartmorgan+watch_chromium.org
Visibility:
Public.

Description

[Sync] Ensure all accesses to SyncInternal's observers are thread safe. BUG=72913 TEST=unit tests with tsan Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88472

Patch Set 1 #

Total comments: 6

Patch Set 2 : widen suppression for other race #

Patch Set 3 : lint #

Patch Set 4 : fix #

Total comments: 8

Patch Set 5 : Review #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -40 lines) Patch
M chrome/browser/sync/engine/syncapi.cc View 1 2 3 4 20 chunks +96 lines, -31 lines 2 comments Download
M tools/valgrind/tsan/suppressions.txt View 1 1 chunk +1 line, -9 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Nicolas Zea
Initial work
9 years, 6 months ago (2011-06-08 20:31:21 UTC) #1
tim (not reviewing)
http://codereview.chromium.org/7044059/diff/1/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/1/chrome/browser/sync/engine/syncapi.cc#newcode1533 chrome/browser/sync/engine/syncapi.cc:1533: // from any thread and added to/removed from on ...
9 years, 6 months ago (2011-06-08 20:51:24 UTC) #2
Nicolas Zea
http://codereview.chromium.org/7044059/diff/1/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/1/chrome/browser/sync/engine/syncapi.cc#newcode1533 chrome/browser/sync/engine/syncapi.cc:1533: // from any thread and added to/removed from on ...
9 years, 6 months ago (2011-06-08 21:01:29 UTC) #3
akalin
http://codereview.chromium.org/7044059/diff/2002/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/2002/chrome/browser/sync/engine/syncapi.cc#newcode1240 chrome/browser/sync/engine/syncapi.cc:1240: bool HaveObservers(); make const http://codereview.chromium.org/7044059/diff/2002/chrome/browser/sync/engine/syncapi.cc#newcode1534 chrome/browser/sync/engine/syncapi.cc:1534: base::Lock observers_lock_; make ...
9 years, 6 months ago (2011-06-08 22:39:37 UTC) #4
Nicolas Zea
PTAL http://codereview.chromium.org/7044059/diff/2002/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/2002/chrome/browser/sync/engine/syncapi.cc#newcode1240 chrome/browser/sync/engine/syncapi.cc:1240: bool HaveObservers(); On 2011/06/08 22:39:38, akalin wrote: > ...
9 years, 6 months ago (2011-06-08 23:10:23 UTC) #5
akalin
LGTM http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/syncapi.cc#newcode1241 chrome/browser/sync/engine/syncapi.cc:1241: void CopyObservers(ObserverList<SyncManager::Observer>* observers_copy); this should be const, too
9 years, 6 months ago (2011-06-08 23:14:40 UTC) #6
Nicolas Zea
Committing if this is still okay. http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/syncapi.cc File chrome/browser/sync/engine/syncapi.cc (right): http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/syncapi.cc#newcode1241 chrome/browser/sync/engine/syncapi.cc:1241: void CopyObservers(ObserverList<SyncManager::Observer>* observers_copy); ...
9 years, 6 months ago (2011-06-08 23:25:33 UTC) #7
akalin
On 2011/06/08 23:25:33, nzea wrote: > Committing if this is still okay. > > http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/syncapi.cc ...
9 years, 6 months ago (2011-06-08 23:43:03 UTC) #8
commit-bot: I haz the power
Change committed as 88472
9 years, 6 months ago (2011-06-09 01:58:40 UTC) #9
tim (not reviewing)
9 years, 6 months ago (2011-06-09 02:02:44 UTC) #10
On 2011/06/08 23:43:03, akalin wrote:
> On 2011/06/08 23:25:33, nzea wrote:
> > Committing if this is still okay.
> > 
> >
>
http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/s...
> > File chrome/browser/sync/engine/syncapi.cc (right):
> > 
> >
>
http://codereview.chromium.org/7044059/diff/5003/chrome/browser/sync/engine/s...
> > chrome/browser/sync/engine/syncapi.cc:1241: void
> > CopyObservers(ObserverList<SyncManager::Observer>* observers_copy);
> > On 2011/06/08 23:14:41, akalin wrote:
> > > this should be const, too
> > 
> > ObserverList does not have a const iterator, so this method can't be made
> const.
> > Not sure if there is a reason for that lack of a const iterator or not.
> 
> Okay, that's fine.  Still LGTM.

From a 'clean' perspective I actually thought the new macro was nice as it
resulted in less boilerplate :)  And maybe made the code less prone to errors
forgetting the 'CopyObservers' bit when adding a new observe callsite or
copy/pasting.  But either works.

I'm still a bit puzzled where we end up racing between notifying, and
add/remove.  I'll read up :)

Powered by Google App Engine
This is Rietveld 408576698