New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 627209 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Last visit 16 days ago
Closed: Jul 2016
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

FOR_EACH_OBSERVER does not support dependent types

Project Member Reported by lhchavez@chromium.org, Jul 11 2016

Issue description

template <typename T>
struct Observer {
public:
 void OnEvent();
};

template <typename T>
class Bar {
public:
  void Event() {
    FOR_EACH_OBSERVER(Observer<T>, observer_list_, OnEvent());
  }

private:
  base::ObserverList<Observer<T>> observer_list_;
};

The above code fails to compile since the FOR_EACH_OBSERVER macro expansion cannot figure out the type of base::ObserevrListBase<ObserverType> since it is a dependent type.
 
Status: Started (was: Untriaged)
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/89b89baef6868ee3c23c0c68f100179fb03f7217

commit 89b89baef6868ee3c23c0c68f100179fb03f7217
Author: lhchavez <lhchavez@chromium.org>
Date: Wed Jul 13 03:47:47 2016

Add support for dependent types in FOR_EACH_OBSERVER

In the expansion of FOR_EACH_OBSERVER, there is a
base::ObserverListBase<ObserverType>::Iterator. If ObserverType is a
templated type, it won't compile due to a lack of a 'typename'. This
change fixes that.

BUG= 627209 
TEST=dependent types now compile

Review-Url: https://codereview.chromium.org/2137183003
Cr-Commit-Position: refs/heads/master@{#404980}

[modify] https://crrev.com/89b89baef6868ee3c23c0c68f100179fb03f7217/base/observer_list.h

Project Member

Comment 3 by bugdroid1@chromium.org, Jul 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/05b7d4f124a608289ff685341c146cb7e38f1fd6

commit 05b7d4f124a608289ff685341c146cb7e38f1fd6
Author: lhchavez <lhchavez@chromium.org>
Date: Wed Jul 13 16:13:56 2016

arc: Use FOR_EACH_OBSERVER in InstanceHolder

Now that FOR_EACH_OBSERVER supports dependent types, we can use it
instead of its expansion.

BUG= 627209 
TEST=trybots

Review-Url: https://codereview.chromium.org/2147443005
Cr-Commit-Position: refs/heads/master@{#405174}

[modify] https://crrev.com/05b7d4f124a608289ff685341c146cb7e38f1fd6/components/arc/instance_holder.h

Status: Verified (was: Started)
Project Member

Comment 5 by bugdroid1@chromium.org, Jul 13 2016

Labels: merge-merged-2795
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/89b89baef6868ee3c23c0c68f100179fb03f7217

commit 89b89baef6868ee3c23c0c68f100179fb03f7217
Author: lhchavez <lhchavez@chromium.org>
Date: Wed Jul 13 03:47:47 2016

Add support for dependent types in FOR_EACH_OBSERVER

In the expansion of FOR_EACH_OBSERVER, there is a
base::ObserverListBase<ObserverType>::Iterator. If ObserverType is a
templated type, it won't compile due to a lack of a 'typename'. This
change fixes that.

BUG= 627209 
TEST=dependent types now compile

Review-Url: https://codereview.chromium.org/2137183003
Cr-Commit-Position: refs/heads/master@{#404980}

[modify] https://crrev.com/89b89baef6868ee3c23c0c68f100179fb03f7217/base/observer_list.h

Project Member

Comment 6 by bugdroid1@chromium.org, Jul 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/05b7d4f124a608289ff685341c146cb7e38f1fd6

commit 05b7d4f124a608289ff685341c146cb7e38f1fd6
Author: lhchavez <lhchavez@chromium.org>
Date: Wed Jul 13 16:13:56 2016

arc: Use FOR_EACH_OBSERVER in InstanceHolder

Now that FOR_EACH_OBSERVER supports dependent types, we can use it
instead of its expansion.

BUG= 627209 
TEST=trybots

Review-Url: https://codereview.chromium.org/2147443005
Cr-Commit-Position: refs/heads/master@{#405174}

[modify] https://crrev.com/05b7d4f124a608289ff685341c146cb7e38f1fd6/components/arc/instance_holder.h

Sign in to add a comment