Chromium Code Reviews| Index: net/cert/sth_distributor.h |
| diff --git a/net/cert/sth_distributor.h b/net/cert/sth_distributor.h |
| index 3d9691cc56c029a47c627f6aee0987d7e2b5c3cf..c1ba65cfb4f9ab7bead94b9272f2520f4bd770e1 100644 |
| --- a/net/cert/sth_distributor.h |
| +++ b/net/cert/sth_distributor.h |
| @@ -14,6 +14,16 @@ namespace net { |
| namespace ct { |
| +namespace internal { |
| + |
| +// Compares SignedTreeHeads by their log ID, to facilitate creation of a |
| +// map of STHs where there's only one STH for each log. |
| +struct STHLogIDComparator { |
| + bool operator()(const SignedTreeHead& first, const SignedTreeHead& second); |
| +}; |
| + |
| +} // namespace internal |
|
Ryan Sleevi
2016/05/12 19:51:28
DESIGN: You don't need to expose this in a public
Eran Messeri
2016/05/13 09:04:08
Done.
|
| + |
| // A proxy for delegating new STH notifications to all registered |
| // observers. |
| // For each |observer| registered with RegisterObserver, the |
| @@ -28,10 +38,20 @@ class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { |
| void NewSTHObserved(const SignedTreeHead& sth) override; |
| // STHReporter implementation |
| + // Registers |observer| for new STH notifications and invokes the |
| + // new STH notification of this |observer| with observed STHs (one |
| + // per log). |
| void RegisterObserver(STHObserver* observer) override; |
| + |
| + // Unregisters |observer|, should only be called with observers |
| + // that were previously registered via RegisterObserver; |
| void UnregisterObserver(STHObserver* observer) override; |
| private: |
| + // Set of unique STHs from logs. |
| + std::set<SignedTreeHead, internal::STHLogIDComparator> observed_sths_; |
|
Ryan Sleevi
2016/05/12 19:51:28
DESIGN: An std::set<> is pretty inefficient for yo
Eran Messeri
2016/05/13 09:04:08
Done.
|
| + |
| + // The observers for new STH notifications. |
| base::ObserverList<STHObserver> observer_list_; |
| }; |