[tracing] Make ObservedProperty traceable in performance manager [chromium/src : main]

9 views
Skip to first unread message

Etienne Pierre-Doray (Gerrit)

unread,
Aug 22, 2025, 10:12:18 AMAug 22
to Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Joe Mason

Etienne Pierre-Doray added 1 comment

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Etienne Pierre-Doray . resolved

PTAL

Open in Gerrit

Related details

Attention is currently required from:
  • Joe Mason
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
Gerrit-Change-Number: 6870357
Gerrit-PatchSet: 6
Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Joe Mason <joenot...@google.com>
Gerrit-Attention: Joe Mason <joenot...@google.com>
Gerrit-Comment-Date: Fri, 22 Aug 2025 14:12:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Lalit Maganti (Gerrit)

unread,
Aug 22, 2025, 6:43:36 PMAug 22
to Etienne Pierre-Doray, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray and Joe Mason

Lalit Maganti added 1 comment

File base/test/test_suite.cc
Line 532, Patchset 8 (Latest): perfetto::internal::TrackRegistry::InitializeInstance();
Lalit Maganti . unresolved

Given this a function in the internal namespace, I'd strongly suggest *not* depending on this and finding another way to expose what you need from the SDK officially.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Joe Mason
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
    Gerrit-Change-Number: 6870357
    Gerrit-PatchSet: 8
    Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-CC: Lalit Maganti <lal...@google.com>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Attention: Joe Mason <joenot...@google.com>
    Gerrit-Comment-Date: Fri, 22 Aug 2025 22:43:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Aug 22, 2025, 6:58:27 PMAug 22
    to Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Joe Mason and Lalit Maganti

    Etienne Pierre-Doray added 1 comment

    File base/test/test_suite.cc
    Line 532, Patchset 8 (Latest): perfetto::internal::TrackRegistry::InitializeInstance();
    Lalit Maganti . unresolved

    Given this a function in the internal namespace, I'd strongly suggest *not* depending on this and finding another way to expose what you need from the SDK officially.

    Etienne Pierre-Doray

    TrackRegistry::InitializeInstance is called from Tracing::Initialize(const TracingInitArgs& args), so we can indeed set the uuid in TracingInitArgs.
    But the fact that we call TrackRegistry::InitializeInstance directly doesn't have much to do with this CL.
    See https://source.chromium.org/chromium/chromium/src/+/main:services/tracing/public/cpp/trace_startup.cc;l=64;drc=18d241cf44a9580c0d53dfb9e5b16a9c95f164b6;bpv=1;bpt=1
    that comment is stale; but we need to call TrackRegistry::InitializeInstance to untie a circular dependency: the platform provided to Tracing::Initialize needs a thread started by chrome, which may use Track API which would crash if TrackRegistry isn't registered first.
    As for this particular testing call, it could probably simply call Tracing::Initialize and use the perfetto platform, but there's no need to initialize perfetto entirely, this is only needed to allow TrackEvent::SetTrackDescriptor()

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joe Mason
    • Lalit Maganti
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
    Gerrit-Change-Number: 6870357
    Gerrit-PatchSet: 8
    Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-CC: Lalit Maganti <lal...@google.com>
    Gerrit-Attention: Lalit Maganti <lal...@google.com>
    Gerrit-Attention: Joe Mason <joenot...@google.com>
    Gerrit-Comment-Date: Fri, 22 Aug 2025 22:58:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Lalit Maganti <lal...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Aug 25, 2025, 3:53:00 PMAug 25
    to Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Joe Mason and Lalit Maganti

    Etienne Pierre-Doray added 1 comment

    File base/test/test_suite.cc
    Line 532, Patchset 8: perfetto::internal::TrackRegistry::InitializeInstance();
    Lalit Maganti . resolved

    Given this a function in the internal namespace, I'd strongly suggest *not* depending on this and finding another way to expose what you need from the SDK officially.

    Etienne Pierre-Doray

    TrackRegistry::InitializeInstance is called from Tracing::Initialize(const TracingInitArgs& args), so we can indeed set the uuid in TracingInitArgs.
    But the fact that we call TrackRegistry::InitializeInstance directly doesn't have much to do with this CL.
    See https://source.chromium.org/chromium/chromium/src/+/main:services/tracing/public/cpp/trace_startup.cc;l=64;drc=18d241cf44a9580c0d53dfb9e5b16a9c95f164b6;bpv=1;bpt=1
    that comment is stale; but we need to call TrackRegistry::InitializeInstance to untie a circular dependency: the platform provided to Tracing::Initialize needs a thread started by chrome, which may use Track API which would crash if TrackRegistry isn't registered first.
    As for this particular testing call, it could probably simply call Tracing::Initialize and use the perfetto platform, but there's no need to initialize perfetto entirely, this is only needed to allow TrackEvent::SetTrackDescriptor()

    Etienne Pierre-Doray

    I added conditional in code to avoid this for now.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joe Mason
    • Lalit Maganti
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
    Gerrit-Change-Number: 6870357
    Gerrit-PatchSet: 9
    Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Joe Mason <joenot...@google.com>
    Gerrit-CC: Lalit Maganti <lal...@google.com>
    Gerrit-Attention: Lalit Maganti <lal...@google.com>
    Gerrit-Attention: Joe Mason <joenot...@google.com>
    Gerrit-Comment-Date: Mon, 25 Aug 2025 19:52:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Lalit Maganti <lal...@google.com>
    Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Mason (Gerrit)

    unread,
    Aug 26, 2025, 11:54:17 AMAug 26
    to Etienne Pierre-Doray, Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Etienne Pierre-Doray and Lalit Maganti

    Joe Mason added 11 comments

    Patchset-level comments
    File-level comment, Patchset 9 (Latest):
    Joe Mason . resolved

    Initial comments, haven't reviewed TracingObserver yet.

    File base/test/test_suite.cc
    Line 532, Patchset 8: perfetto::internal::TrackRegistry::InitializeInstance();
    Lalit Maganti . resolved

    Given this a function in the internal namespace, I'd strongly suggest *not* depending on this and finding another way to expose what you need from the SDK officially.

    Etienne Pierre-Doray

    TrackRegistry::InitializeInstance is called from Tracing::Initialize(const TracingInitArgs& args), so we can indeed set the uuid in TracingInitArgs.
    But the fact that we call TrackRegistry::InitializeInstance directly doesn't have much to do with this CL.
    See https://source.chromium.org/chromium/chromium/src/+/main:services/tracing/public/cpp/trace_startup.cc;l=64;drc=18d241cf44a9580c0d53dfb9e5b16a9c95f164b6;bpv=1;bpt=1
    that comment is stale; but we need to call TrackRegistry::InitializeInstance to untie a circular dependency: the platform provided to Tracing::Initialize needs a thread started by chrome, which may use Track API which would crash if TrackRegistry isn't registered first.
    As for this particular testing call, it could probably simply call Tracing::Initialize and use the perfetto platform, but there's no need to initialize perfetto entirely, this is only needed to allow TrackEvent::SetTrackDescriptor()

    Etienne Pierre-Doray

    I added conditional in code to avoid this for now.

    Joe Mason

    Agree that checking if initialized every time is better than initializing the registry only. I suggested adding a helper function for that.

    File components/performance_manager/graph/frame_node_impl.cc
    Line 37, Patchset 9 (Latest): parent_track ? *parent_track : perfetto::ProcessTrack::Current())
    Joe Mason . unresolved

    Nit: could use a comment saying where the FrameNode track will show up in practice. "Current()" would be the browser process, right? When would this happen?)

    Line 43, Patchset 9 (Latest): base::TrackEvent::SetTrackDescriptor(track, track.Serialize());
    Joe Mason . unresolved

    Now that we've got several places in the code that have to do this, it could use a utility function. Maybe `void base::tracing::InitializeTrack<TrackType>(const TrackType& track)` so that the impl can call the correct `track.Serialize()` func.

    This can be a follow-up.

    Line 107, Patchset 9 (Latest): tracing_track_,
    Joe Mason . unresolved

    Nit: why isn't this getting its own track? Could use a comment, if it's intentional.

    File components/performance_manager/graph/properties.h
    Line 132, Patchset 9 (Latest): class Wrapper = TrivialWrapper<PropertyType>>
    Joe Mason . unresolved

    Does this work?

    ```
    template <typename PropertyType,
    void (ObserverType::*NotifyFunctionPtr)(const NodeType*),
    typename WrapperTemplate = TrivialWrapper,
    typename Wrapper = WrapperTemplate<PropertyType>>
    ```

    That way a property decl wouldn't need to repeat the PropertyType in the wrapper:

    ```
    ObservedProperty::NotifiesOnlyOnChanges<bool,
    &PageNodeObserver::OnIsFocusedChanged,
    TracedWrapper>
    ```

    I'd really like to find a way to avoid that repetition. (Can clean it up as a followup though.)

    Line 91, Patchset 9 (Latest): template <typename U = PropertyType>
    Joe Mason . unresolved

    Nit: blank line before this.

    Line 75, Patchset 9 (Latest): slice_is_open_ = !!value_str;
    Joe Mason . unresolved

    Nit: I always find `!!` confusing. I'd prefer explicit `value_str != nullptr` or `bool{value_str}`.

    I'd actually prefer this, to keep all the code that depends on `slice_is_open_` in the same control flow block, but it's a judgement call:

    ```
    if (slice_is_open_) {
    TRACE_EVENT_END(...);
    slice_is_open_ = false;
    }
    if (value_str) {
    TRACE_EVENT_BEGIN(...);
    slice_is_open_ = true;
    }
    ```
    Line 61, Patchset 9 (Latest): const PropertyType& value() const& { return value_; }
    Joe Mason . unresolved

    Can you add a comment explaining what we discussed offline?

    eg. "The && qualified method forwards `std::move(wrapper)` to `wrapper.value_`. It requires the const method to be `const&` to avoid ambiguity."

    Line 44, Patchset 9 (Latest): ~TracedWrapper() {
    Joe Mason . unresolved

    Please fix this WARNING reported by ClangTidy: check: modernize-use-override

    annotate this function with 'override' or (rarely...

    check: modernize-use-override

    annotate this function with 'override' or (rarely) 'final' (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-override.html)

    (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-override` footer to the CL description to skip the check)

    (Note: running clang-tidy on this file failed; this diagnostic might be incorrect as a result.)

    (Lint observed on `linux-clang-tidy-rel`, but not on `android-clang-tidy-rel`)

    Line 24, Patchset 9 (Latest): TracedWrapper(perfetto::NamedTrack track, ConverterFuncPtr converter_func)
    Joe Mason . unresolved

    Nit: please add blank lines before method declarations. Easier to read.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Etienne Pierre-Doray
    • Lalit Maganti
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
      Gerrit-Change-Number: 6870357
      Gerrit-PatchSet: 9
      Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Joe Mason <joenot...@google.com>
      Gerrit-CC: Lalit Maganti <lal...@google.com>
      Gerrit-Attention: Lalit Maganti <lal...@google.com>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Tue, 26 Aug 2025 15:54:11 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Joe Mason (Gerrit)

      unread,
      Aug 26, 2025, 12:11:49 PMAug 26
      to Etienne Pierre-Doray, Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Etienne Pierre-Doray and Lalit Maganti

      Joe Mason voted and added 3 comments

      Votes added by Joe Mason

      Code-Review+1

      3 comments

      Patchset-level comments
      Joe Mason . resolved

      LGTM with nits, although I'd like to try to get rid of the duplicate types in ObservedProperty as a followup.

      File components/performance_manager/graph/tracing_observer.h
      Line 38, Patchset 9 (Latest): base::ObserverList<TracingObserver> observers_;
      Joe Mason . unresolved

      Optional suggestion: If you make this a `base::ObserverListThreadSafe`, you won't need to store a TaskRunner or WeakPtrFactor - the sequence checker ensures RegisterObserver and UnregisterObserver are always called from the same sequence as the constructor, and then you can just call `observers_.Notify` directly. `base::ObserverListThreadSafe::Notify` takes care of posting to the correct sequence, and checking if the observer still exist when the notification arrives.

      OTOH it posts once for each observer, which is slightly less efficient. But tracing doesn't start/stop often so that shouldn't matter.

      If you use ObserverListThreadSafe please use `RemoveObserverPolicy::kAddingSequenceOnly` which is safer but not the default because it was added later.

      Line 29, Patchset 9 (Latest): void RegisterObserver(TracingObserver* observer);
      Joe Mason . unresolved

      Nit: prefer to name these AddObserver and RemoveObserver so that base::ScopedObservation works with them.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      • Lalit Maganti
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
      Gerrit-Change-Number: 6870357
      Gerrit-PatchSet: 9
      Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Joe Mason <joenot...@google.com>
      Gerrit-CC: Lalit Maganti <lal...@google.com>
      Gerrit-Attention: Lalit Maganti <lal...@google.com>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Tue, 26 Aug 2025 16:11:43 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      Aug 26, 2025, 3:14:27 PMAug 26
      to Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Lalit Maganti

      Etienne Pierre-Doray added 12 comments

      Patchset-level comments
      File-level comment, Patchset 11 (Latest):
      Etienne Pierre-Doray . resolved

      PTAnL?

      File components/performance_manager/graph/frame_node_impl.cc
      Line 37, Patchset 9: parent_track ? *parent_track : perfetto::ProcessTrack::Current())
      Joe Mason . resolved

      Nit: could use a comment saying where the FrameNode track will show up in practice. "Current()" would be the browser process, right? When would this happen?)

      Etienne Pierre-Doray

      Done
      The track is added under browser when renderer isn't available, but this is fixed in a following CL.

      Line 43, Patchset 9: base::TrackEvent::SetTrackDescriptor(track, track.Serialize());
      Joe Mason . resolved

      Now that we've got several places in the code that have to do this, it could use a utility function. Maybe `void base::tracing::InitializeTrack<TrackType>(const TrackType& track)` so that the impl can call the correct `track.Serialize()` func.

      This can be a follow-up.

      Etienne Pierre-Doray

      Good idea, Done.

      Line 107, Patchset 9: tracing_track_,
      Joe Mason . resolved

      Nit: why isn't this getting its own track? Could use a comment, if it's intentional.

      Etienne Pierre-Doray

      Done.
      For convenience, I find visibility is the main thing of interest w.r.t frames in renderer. It fully describes the lifetime as well.

      File components/performance_manager/graph/properties.h
      Line 132, Patchset 9: class Wrapper = TrivialWrapper<PropertyType>>
      Joe Mason . unresolved

      Does this work?

      ```
      template <typename PropertyType,
      void (ObserverType::*NotifyFunctionPtr)(const NodeType*),
      typename WrapperTemplate = TrivialWrapper,
      typename Wrapper = WrapperTemplate<PropertyType>>
      ```

      That way a property decl wouldn't need to repeat the PropertyType in the wrapper:

      ```
      ObservedProperty::NotifiesOnlyOnChanges<bool,
      &PageNodeObserver::OnIsFocusedChanged,
      TracedWrapper>
      ```

      I'd really like to find a way to avoid that repetition. (Can clean it up as a followup though.)

      Etienne Pierre-Doray

      More or less, it'd be something like `template <typename U> class WrapperTemplate = TrivialWrapper`
      The big downside is that all wrappers must then be in the form Wrapper<T>, which prevents potentially having ConverterFunc as wrapper template param.
      I feel the gain is't worth the limitation, WDYT?

      Another option is to *only* (and always) provide the wrapper type (and have PropertyType deduced from it):
      ```
      ObservedProperty::NotifiesOnlyOnChanges<TracedWrapper<bool>,
      &PageNodeObserver::OnIsFocusedChanged>
      ```
      But this would require changing all ObservedProperty at once.
      Line 91, Patchset 9: template <typename U = PropertyType>
      Joe Mason . resolved

      Nit: blank line before this.

      Etienne Pierre-Doray

      Done

      Line 75, Patchset 9: slice_is_open_ = !!value_str;
      Joe Mason . resolved

      Nit: I always find `!!` confusing. I'd prefer explicit `value_str != nullptr` or `bool{value_str}`.

      I'd actually prefer this, to keep all the code that depends on `slice_is_open_` in the same control flow block, but it's a judgement call:

      ```
      if (slice_is_open_) {
      TRACE_EVENT_END(...);
      slice_is_open_ = false;
      }
      if (value_str) {
      TRACE_EVENT_BEGIN(...);
      slice_is_open_ = true;
      }
      ```
      Etienne Pierre-Doray

      Done

      Line 61, Patchset 9: const PropertyType& value() const& { return value_; }
      Joe Mason . resolved

      Can you add a comment explaining what we discussed offline?

      eg. "The && qualified method forwards `std::move(wrapper)` to `wrapper.value_`. It requires the const method to be `const&` to avoid ambiguity."

      Etienne Pierre-Doray

      Done

      Line 44, Patchset 9: ~TracedWrapper() {
      Joe Mason . resolved

      Please fix this WARNING reported by ClangTidy: check: modernize-use-override

      annotate this function with 'override' or (rarely...

      check: modernize-use-override

      annotate this function with 'override' or (rarely) 'final' (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-override.html)

      (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-override` footer to the CL description to skip the check)

      (Note: running clang-tidy on this file failed; this diagnostic might be incorrect as a result.)

      (Lint observed on `linux-clang-tidy-rel`, but not on `android-clang-tidy-rel`)

      Etienne Pierre-Doray

      Done

      Line 24, Patchset 9: TracedWrapper(perfetto::NamedTrack track, ConverterFuncPtr converter_func)
      Joe Mason . resolved

      Nit: please add blank lines before method declarations. Easier to read.

      Etienne Pierre-Doray

      Done

      File components/performance_manager/graph/tracing_observer.h
      Line 38, Patchset 9: base::ObserverList<TracingObserver> observers_;
      Joe Mason . unresolved

      Optional suggestion: If you make this a `base::ObserverListThreadSafe`, you won't need to store a TaskRunner or WeakPtrFactor - the sequence checker ensures RegisterObserver and UnregisterObserver are always called from the same sequence as the constructor, and then you can just call `observers_.Notify` directly. `base::ObserverListThreadSafe::Notify` takes care of posting to the correct sequence, and checking if the observer still exist when the notification arrives.

      OTOH it posts once for each observer, which is slightly less efficient. But tracing doesn't start/stop often so that shouldn't matter.

      If you use ObserverListThreadSafe please use `RemoveObserverPolicy::kAddingSequenceOnly` which is safer but not the default because it was added later.

      Etienne Pierre-Doray

      I find that the PostTask is simple enough and it makes it clearer this is single threaded with the exception of TracingObserverList::OnStart.
      But I don't feel very strongly about this.

      Line 29, Patchset 9: void RegisterObserver(TracingObserver* observer);
      Joe Mason . resolved

      Nit: prefer to name these AddObserver and RemoveObserver so that base::ScopedObservation works with them.

      Etienne Pierre-Doray

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Lalit Maganti
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
        Gerrit-Change-Number: 6870357
        Gerrit-PatchSet: 11
        Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Joe Mason <joenot...@google.com>
        Gerrit-CC: Lalit Maganti <lal...@google.com>
        Gerrit-Attention: Lalit Maganti <lal...@google.com>
        Gerrit-Comment-Date: Tue, 26 Aug 2025 19:14:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Joe Mason <joenot...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Joe Mason (Gerrit)

        unread,
        Aug 28, 2025, 4:28:10 PM (12 days ago) Aug 28
        to Etienne Pierre-Doray, Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

        Joe Mason added 2 comments

        File components/performance_manager/graph/properties.h
        Line 132, Patchset 9: class Wrapper = TrivialWrapper<PropertyType>>
        Joe Mason . resolved

        Does this work?

        ```
        template <typename PropertyType,
        void (ObserverType::*NotifyFunctionPtr)(const NodeType*),
        typename WrapperTemplate = TrivialWrapper,
        typename Wrapper = WrapperTemplate<PropertyType>>
        ```

        That way a property decl wouldn't need to repeat the PropertyType in the wrapper:

        ```
        ObservedProperty::NotifiesOnlyOnChanges<bool,
        &PageNodeObserver::OnIsFocusedChanged,
        TracedWrapper>
        ```

        I'd really like to find a way to avoid that repetition. (Can clean it up as a followup though.)

        Etienne Pierre-Doray

        More or less, it'd be something like `template <typename U> class WrapperTemplate = TrivialWrapper`
        The big downside is that all wrappers must then be in the form Wrapper<T>, which prevents potentially having ConverterFunc as wrapper template param.
        I feel the gain is't worth the limitation, WDYT?

        Another option is to *only* (and always) provide the wrapper type (and have PropertyType deduced from it):
        ```
        ObservedProperty::NotifiesOnlyOnChanges<TracedWrapper<bool>,
        &PageNodeObserver::OnIsFocusedChanged>
        ```
        But this would require changing all ObservedProperty at once.
        Joe Mason

        I like the second one, but a big-bang conversion can wait for a followup.

        File components/performance_manager/graph/tracing_observer.h
        Line 38, Patchset 9: base::ObserverList<TracingObserver> observers_;
        Joe Mason . resolved

        Optional suggestion: If you make this a `base::ObserverListThreadSafe`, you won't need to store a TaskRunner or WeakPtrFactor - the sequence checker ensures RegisterObserver and UnregisterObserver are always called from the same sequence as the constructor, and then you can just call `observers_.Notify` directly. `base::ObserverListThreadSafe::Notify` takes care of posting to the correct sequence, and checking if the observer still exist when the notification arrives.

        OTOH it posts once for each observer, which is slightly less efficient. But tracing doesn't start/stop often so that shouldn't matter.

        If you use ObserverListThreadSafe please use `RemoveObserverPolicy::kAddingSequenceOnly` which is safer but not the default because it was added later.

        Etienne Pierre-Doray

        I find that the PostTask is simple enough and it makes it clearer this is single threaded with the exception of TracingObserverList::OnStart.
        But I don't feel very strongly about this.

        Joe Mason

        Acknowledged

        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
        Gerrit-Change-Number: 6870357
        Gerrit-PatchSet: 12
        Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Joe Mason <joenot...@google.com>
        Gerrit-CC: Lalit Maganti <lal...@google.com>
        Gerrit-Comment-Date: Thu, 28 Aug 2025 20:28:04 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
        Comment-In-Reply-To: Joe Mason <joenot...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Joe Mason (Gerrit)

        unread,
        Aug 28, 2025, 4:31:28 PM (12 days ago) Aug 28
        to Etienne Pierre-Doray, Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
        Attention needed from Etienne Pierre-Doray

        Joe Mason voted Code-Review+1

        Code-Review+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Etienne Pierre-Doray
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
          Gerrit-Change-Number: 6870357
          Gerrit-PatchSet: 12
          Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Joe Mason <joenot...@google.com>
          Gerrit-CC: Lalit Maganti <lal...@google.com>
          Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Comment-Date: Thu, 28 Aug 2025 20:31:22 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Etienne Pierre-Doray (Gerrit)

          unread,
          Aug 29, 2025, 8:51:57 AM (11 days ago) Aug 29
          to Lalit Maganti, Chromium LUCI CQ, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

          Etienne Pierre-Doray voted Commit-Queue+2

          Commit-Queue+2
          Open in Gerrit

          Related details

          Attention set is empty
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
          Gerrit-Change-Number: 6870357
          Gerrit-PatchSet: 12
          Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Joe Mason <joenot...@google.com>
          Gerrit-CC: Lalit Maganti <lal...@google.com>
          Gerrit-Comment-Date: Fri, 29 Aug 2025 12:51:50 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Chromium LUCI CQ (Gerrit)

          unread,
          Aug 29, 2025, 10:04:24 AM (11 days ago) Aug 29
          to Etienne Pierre-Doray, Lalit Maganti, chromium...@chromium.org, performance-m...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

          Chromium LUCI CQ submitted the change

          Change information

          Commit message:
          [tracing] Make ObservedProperty traceable in performance manager

          This CL adds a mechanism to optionally trace properties, and uses it
          for a few properties in the graph. This also adds new tracing track
          in FrameNodeImpl.
          Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
          Commit-Queue: Etienne Pierre-Doray <etie...@chromium.org>
          Reviewed-by: Joe Mason <joenot...@google.com>
          Cr-Commit-Position: refs/heads/main@{#1508339}
          Files:
          • M base/trace_event/builtin_categories.h
          • M base/trace_event/trace_event.h
          • M components/performance_manager/BUILD.gn
          • M components/performance_manager/embedder/graph_features.h
          • M components/performance_manager/graph/frame_node_impl.cc
          • M components/performance_manager/graph/frame_node_impl.h
          • M components/performance_manager/graph/frame_node_impl_describer.cc
          • M components/performance_manager/graph/page_node.cc
          • M components/performance_manager/graph/page_node_impl.cc
          • M components/performance_manager/graph/page_node_impl.h
          • A components/performance_manager/graph/properties.cc
          • M components/performance_manager/graph/properties.h
          • A components/performance_manager/graph/tracing_observer.cc
          • A components/performance_manager/graph/tracing_observer.h
          • M components/performance_manager/graph_features.cc
          Change size: L
          Delta: 15 files changed, 400 insertions(+), 96 deletions(-)
          Branch: refs/heads/main
          Submit Requirements:
          • requirement satisfiedCode-Review: +1 by Joe Mason
          Open in Gerrit
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: merged
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I4672b7e5e4be8397a7c2ac439f48260f55e81ddb
          Gerrit-Change-Number: 6870357
          Gerrit-PatchSet: 13
          Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Joe Mason <joenot...@google.com>
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages