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

Issue 2926663003: [GRC] Coordination Unit Graph Observer (Closed)

Created:
3 years, 6 months ago by matthalp
Modified:
3 years, 6 months ago
CC:
chromium-reviews, ducbui, fmeawad, lpy
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[GRC] Coordination Unit Graph Observer The CoordinationUnitGraphObserver is a framework for observing and responding to “interesting events” that occur throughout coordination unit lifetimes’ within GRC. It utilizes an event listener model similar in spirit to JavaScript’s event-driven programming model. Design Doc Link: https://docs.google.com/a/google.com/document/d/1LbtpGa3pu9o4qAIC6VMWrdq3Yvd2f2FVzP0te6YtCyk/edit?usp=sharing Example Usage: https://codereview.chromium.org/2925123002 R=*oysteine@chromium.org,*zhenw@chromium.org,lpy@google.com,fmeawad@chromium.org BUG=724306

Patch Set 1 #

Patch Set 2 : Add listener filtering capabilities #

Patch Set 3 : Remove unnecessary logging #

Patch Set 4 : Add event listener filtering #

Patch Set 5 : Restore blank line after file comment header #

Patch Set 6 : Rebase #

Patch Set 7 : Rebase #

Patch Set 8 : Add unittest #

Patch Set 9 : Update event listener member names #

Patch Set 10 : Rebase #

Patch Set 11 : Rebase #

Patch Set 12 : Rebase #

Patch Set 13 : Format #

Patch Set 14 : Fix comment typo #

Total comments: 15

Patch Set 15 : Address review feedback #

Patch Set 16 : Address review feedback #

Patch Set 17 : Remove unnecessary mojo enum entry #

Patch Set 18 : Rebase #

Total comments: 38

Patch Set 19 : Address review feedback #

Total comments: 4

Patch Set 20 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+688 lines, -15 lines) Patch
M services/resource_coordinator/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 18 19 2 chunks +3 lines, -0 lines 0 comments Download
A services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +61 lines, -0 lines 0 comments Download
A services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +31 lines, -0 lines 0 comments Download
A services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +337 lines, -0 lines 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +133 lines, -1 line 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +47 lines, -3 lines 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -1 line 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +15 lines, -0 lines 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +28 lines, -3 lines 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h View 3 chunks +6 lines, -1 line 0 comments Download
M services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +21 lines, -6 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 56 (44 generated)
matthalp
3 years, 6 months ago (2017-06-07 17:33:27 UTC) #1
matthalp
Adding reviewers
3 years, 6 months ago (2017-06-07 21:58:47 UTC) #3
zhenw
I have some high level comments. https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h File services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h (right): https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode27 services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h:27: class CoordinationUnitGraphObserver { ...
3 years, 6 months ago (2017-06-13 18:38:41 UTC) #9
matthalp
https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h File services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h (right): https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode27 services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h:27: class CoordinationUnitGraphObserver { On 2017/06/13 at 18:38:41, zhenw wrote: ...
3 years, 6 months ago (2017-06-13 20:57:11 UTC) #10
Zhen Wang
https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h File services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h (right): https://codereview.chromium.org/2926663003/diff/260001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode27 services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h:27: class CoordinationUnitGraphObserver { OK. As long as observers outlive ...
3 years, 6 months ago (2017-06-14 00:33:03 UTC) #11
Zhen Wang
https://codereview.chromium.org/2926663003/diff/340001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h File services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h (right): https://codereview.chromium.org/2926663003/diff/340001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode38 services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h:38: // The CoordinationUnitmanagerObserver will only call s/CoordinationUnitmanagerObserver/CoordinationUnitManager ? https://codereview.chromium.org/2926663003/diff/340001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode44 ...
3 years, 6 months ago (2017-06-15 20:07:53 UTC) #33
matthalp
https://codereview.chromium.org/2926663003/diff/340001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h File services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h (right): https://codereview.chromium.org/2926663003/diff/340001/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h#newcode38 services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h:38: // The CoordinationUnitmanagerObserver will only call On 2017/06/15 at ...
3 years, 6 months ago (2017-06-16 00:01:27 UTC) #37
matthalp
I realized I left one comment unaddressed (which now has been!). zhenw@ it's ready to ...
3 years, 6 months ago (2017-06-16 16:14:25 UTC) #45
Zhen Wang
Hi Matt, While reviewing the CL, I noticed one difference between CUGraphObserver and many other ...
3 years, 6 months ago (2017-06-16 19:38:20 UTC) #46
Zhen Wang
> class CUGraphObserver { > virtual void OnCUCreated(cu); > virtual void OnAddChildToCU(cu); > virtual void ...
3 years, 6 months ago (2017-06-16 19:45:53 UTC) #47
ducbui
https://codereview.chromium.org/2926663003/diff/360001/services/resource_coordinator/coordination_unit/coordination_unit_impl.h File services/resource_coordinator/coordination_unit/coordination_unit_impl.h (right): https://codereview.chromium.org/2926663003/diff/360001/services/resource_coordinator/coordination_unit/coordination_unit_impl.h#newcode70 services/resource_coordinator/coordination_unit/coordination_unit_impl.h:70: std::map<Filter, std::vector<Listener>> registry_; Is there any reason for not ...
3 years, 6 months ago (2017-06-19 04:09:15 UTC) #53
matthalp
3 years, 6 months ago (2017-06-19 04:18:12 UTC) #56
https://codereview.chromium.org/2926663003/diff/360001/services/resource_coor...
File services/resource_coordinator/coordination_unit/coordination_unit_impl.h
(right):

https://codereview.chromium.org/2926663003/diff/360001/services/resource_coor...
services/resource_coordinator/coordination_unit/coordination_unit_impl.h:70:
std::map<Filter, std::vector<Listener>> registry_;
On 2017/06/19 at 04:09:15, ducbui wrote:
> Is there any reason for not using std::unordered_map in this version?

std::unordered_map requires a std::hash implementation. C++11 does not support
std::hash for the enum classes that will be used as filter (but will be in
C++14). See "2148. Hashing enums should be supported directly by std::hash" in
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2148

The plan is to eventually use std::unordered_map, but I wanted to talk to zhenw
and oysteine to figure out the best way to proceed.

The easiest way is to pass in a hash via an struct-based operator(), which was
used inside of
services/resource_coordinator/public/cpp/coordination_unit_property_types.h for
https://codereview.chromium.org/2940983002.

Given how many places this is useful within services/resource_coordinator/ I
wanted to see if it made sense to have some sort of utils file to be included
where necessary.

https://codereview.chromium.org/2926663003/diff/360001/services/resource_coor...
File services/resource_coordinator/coordination_unit/coordination_unit_manager.h
(right):

https://codereview.chromium.org/2926663003/diff/360001/services/resource_coor...
services/resource_coordinator/coordination_unit/coordination_unit_manager.h:35:
std::unique_ptr<CoordinationUnitGraphObserver> observers);
On 2017/06/19 at 04:09:15, ducbui wrote:
> Maybe a typo? I think "observers" should be "observer".

Yes -- thank you for catching this.

Powered by Google App Engine
This is Rietveld 408576698