mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Document Enviroment is preferred as 1st parameter
No-Try: true Bug: webrtc:15656 Change-Id: I82a642b8a558bad8c3264ab830ff07aea3584c98 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329022 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41258}
This commit is contained in:
parent
680f103baa
commit
db329edf40
1 changed files with 8 additions and 1 deletions
|
@ -40,12 +40,18 @@ class RtcEventLog;
|
||||||
// passed as a construction parameter and saved by value in each class that
|
// passed as a construction parameter and saved by value in each class that
|
||||||
// needs it. Most classes shouldn't create a new instance of the `Environment`,
|
// needs it. Most classes shouldn't create a new instance of the `Environment`,
|
||||||
// but instead should use a propagated copy.
|
// but instead should use a propagated copy.
|
||||||
|
// Usually Environment should be the first parameter in a constructor or a
|
||||||
|
// factory, and the first member in the class. Keeping Environment as the first
|
||||||
|
// member in the class ensures utilities (e.g. clock) are still valid during
|
||||||
|
// destruction of other members.
|
||||||
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// class PeerConnection {
|
// class PeerConnection {
|
||||||
// public:
|
// public:
|
||||||
// PeerConnection(const Environment& env, ...)
|
// PeerConnection(const Environment& env, ...)
|
||||||
// : env_(env),
|
// : env_(env),
|
||||||
// rtp_manager_(env, ...),
|
// log_duration_on_destruction_(&env_.clock()),
|
||||||
|
// rtp_manager_(env_, ...),
|
||||||
// ...
|
// ...
|
||||||
//
|
//
|
||||||
// const FieldTrialsView& trials() const { return env_.field_trials(); }
|
// const FieldTrialsView& trials() const { return env_.field_trials(); }
|
||||||
|
@ -56,6 +62,7 @@ class RtcEventLog;
|
||||||
//
|
//
|
||||||
// private:
|
// private:
|
||||||
// const Environment env_;
|
// const Environment env_;
|
||||||
|
// Stats log_duration_on_destruction_;
|
||||||
// RtpTransmissionManager rtp_manager_;
|
// RtpTransmissionManager rtp_manager_;
|
||||||
// };
|
// };
|
||||||
// This class is thread safe.
|
// This class is thread safe.
|
||||||
|
|
Loading…
Reference in a new issue