diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h index a6c8c06335..f6fae5848c 100644 --- a/api/peerconnectioninterface.h +++ b/api/peerconnectioninterface.h @@ -886,10 +886,10 @@ class PeerConnectionInterface : public rtc::RefCountInterface { return false; } - // Register a metric observer (used by chromium). - // - // There can only be one observer at a time. Before the observer is - // destroyed, RegisterUMAOberver(nullptr) should be called. + // Register a metric observer (used by chromium). It's reference counted, and + // this method takes a reference. RegisterUMAObserver(nullptr) will release + // the reference. + // TODO(deadbeef): Take argument as scoped_refptr? virtual void RegisterUMAObserver(UMAObserver* observer) = 0; // 0 <= min <= current <= max should hold for set parameters. diff --git a/pc/peerconnection.h b/pc/peerconnection.h index d86f2975b3..705fff5001 100644 --- a/pc/peerconnection.h +++ b/pc/peerconnection.h @@ -922,7 +922,7 @@ class PeerConnection : public PeerConnectionInterface, // will refer to the same reference count. rtc::scoped_refptr factory_; PeerConnectionObserver* observer_ = nullptr; - UMAObserver* uma_observer_ = nullptr; + rtc::scoped_refptr uma_observer_ = nullptr; // The EventLog needs to outlive |call_| (and any other object that uses it). std::unique_ptr event_log_;