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

Issue 1956323002: Introduce TraceLog::AsyncEnabledStateObserver (Closed)

Created:
4 years, 7 months ago by Xiaocheng
Modified:
4 years, 7 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce TraceLog::AsyncEnabledStateObserver This CL introduces AsyncEnabledStateObserver as a complement of the potentially thread-unsafe EnabledStateObserver class. The callbacks of the new class are called asynchronously as separate tasks, eliminating the possibility of threading issues when TraceLog and observers are managed in different threads. In follow-up CLs, some subclasses of EnabledStateObserver will be migrated to AsyncEnabledStateObserver instead. BUG=610629 TEST=will be added in a follow-up CL Committed: https://crrev.com/69156980cae08c198a4102dde2a7275f66c4c0c0 Cr-Commit-Position: refs/heads/master@{#392895}

Patch Set 1 #

Total comments: 16

Patch Set 2 : Rename to AsyncEnabledStateObserver and add test cases #

Patch Set 3 : Fix compile error #

Patch Set 4 : Fix more compile error #

Total comments: 16

Patch Set 5 : Style fix #

Patch Set 6 : Use dedicated lock for AsyncESO and remove unit test #

Patch Set 7 : Follow the same lock usage as ESO #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -0 lines) Patch
M base/trace_event/trace_log.h View 1 2 3 4 5 6 3 chunks +25 lines, -0 lines 0 comments Download
M base/trace_event/trace_log.cc View 1 2 3 4 5 6 6 chunks +42 lines, -0 lines 1 comment Download

Dependent Patchsets:

Messages

Total messages: 29 (11 generated)
Xiaocheng
This is the patch following the discussion in https://codereview.chromium.org/1923193002. It seems to work, as I ...
4 years, 7 months ago (2016-05-09 10:19:55 UTC) #3
Primiano Tucci (use gerrit)
This makes great sense to me. RS-LGTM with some comments so you get owner unblocked. ...
4 years, 7 months ago (2016-05-09 17:18:29 UTC) #4
Xiaocheng
Thanks for the review. PTAL at the revised patch (#4). The new class is renamed ...
4 years, 7 months ago (2016-05-10 09:33:38 UTC) #9
Primiano Tucci (use gerrit)
The code LGTM. The test feels a bit too complex (the actual test code has ...
4 years, 7 months ago (2016-05-10 14:20:26 UTC) #10
Sami
lgtm, thanks for putting this together! I agree with Primiano that the test could probably ...
4 years, 7 months ago (2016-05-10 14:42:16 UTC) #11
Xiaocheng
Thanks you for the precious comments. PTAL at patch 6 which actually fixes a bug ...
4 years, 7 months ago (2016-05-11 05:19:20 UTC) #12
Primiano Tucci (use gerrit)
On 2016/05/11 05:19:20, Xiaocheng wrote: > Thanks you for the precious comments. PTAL at patch ...
4 years, 7 months ago (2016-05-11 08:35:54 UTC) #13
Xiaocheng
I've followed Primiano's comment #13 and let AsyncESO use lock in the same way as ...
4 years, 7 months ago (2016-05-11 11:00:29 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956323002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956323002/120001
4 years, 7 months ago (2016-05-11 11:00:40 UTC) #18
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 7 months ago (2016-05-11 11:04:26 UTC) #19
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/69156980cae08c198a4102dde2a7275f66c4c0c0 Cr-Commit-Position: refs/heads/master@{#392895}
4 years, 7 months ago (2016-05-11 11:05:39 UTC) #21
Primiano Tucci (use gerrit)
On 2016/05/11 11:05:39, commit-bot: I haz the power wrote: > Patchset 7 (id:??) landed as ...
4 years, 7 months ago (2016-05-11 12:04:08 UTC) #22
alph
https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace_log.cc File base/trace_event/trace_log.cc (right): https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace_log.cc#newcode647 base/trace_event/trace_log.cc:647: observer_map = async_observers_; You don't need to copy the ...
4 years, 7 months ago (2016-05-11 22:35:52 UTC) #24
lpy
On 2016/05/11 22:35:52, alph wrote: > https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace_log.cc > File base/trace_event/trace_log.cc (right): > > https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace_log.cc#newcode647 > ...
4 years, 7 months ago (2016-05-11 23:11:32 UTC) #25
alph
On 2016/05/11 23:11:32, lpy wrote: > On 2016/05/11 22:35:52, alph wrote: > > > https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace_log.cc ...
4 years, 7 months ago (2016-05-11 23:20:08 UTC) #26
lpy
On 2016/05/11 23:20:08, alph wrote: > On 2016/05/11 23:11:32, lpy wrote: > > On 2016/05/11 ...
4 years, 7 months ago (2016-05-11 23:24:41 UTC) #27
Xiaocheng
On 2016/05/11 at 23:20:08, alph wrote: > On 2016/05/11 23:11:32, lpy wrote: > > On ...
4 years, 7 months ago (2016-05-12 02:09:44 UTC) #28
alph
4 years, 7 months ago (2016-05-12 02:36:46 UTC) #29
Message was sent while issue was closed.
On 2016/05/12 02:09:44, Xiaocheng wrote:
> On 2016/05/11 at 23:20:08, alph wrote:
> > On 2016/05/11 23:11:32, lpy wrote:
> > > On 2016/05/11 22:35:52, alph wrote:
> > > >
> > >
>
https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace...
> > > > File base/trace_event/trace_log.cc (right):
> > > > 
> > > >
> > >
>
https://codereview.chromium.org/1956323002/diff/120001/base/trace_event/trace...
> > > > base/trace_event/trace_log.cc:647: observer_map = async_observers_;
> > > > You don't need to copy the map. You can iterate over it right here.
> > > 
> > > I think async_obersers_ may be modified when there's a thread adding an
> observer
> > > in.
> > 
> > It cannot. The iteration would be within AutoLock lock(lock_); block.
> 
> Sorry but I'm not sure if I understand correctly.
> 
> Do you mean putting the iteration (and the PostTask() calls) inside
> AutoLock(lock_)? If so, there will be a deadlock (detailed in comment #6).

Oh indeed. Thanks.

Powered by Google App Engine
This is Rietveld 408576698