mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +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
|
||||
// needs it. Most classes shouldn't create a new instance of the `Environment`,
|
||||
// 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:
|
||||
// class PeerConnection {
|
||||
// public:
|
||||
// PeerConnection(const Environment& env, ...)
|
||||
// : env_(env),
|
||||
// rtp_manager_(env, ...),
|
||||
// log_duration_on_destruction_(&env_.clock()),
|
||||
// rtp_manager_(env_, ...),
|
||||
// ...
|
||||
//
|
||||
// const FieldTrialsView& trials() const { return env_.field_trials(); }
|
||||
|
@ -56,6 +62,7 @@ class RtcEventLog;
|
|||
//
|
||||
// private:
|
||||
// const Environment env_;
|
||||
// Stats log_duration_on_destruction_;
|
||||
// RtpTransmissionManager rtp_manager_;
|
||||
// };
|
||||
// This class is thread safe.
|
||||
|
|
Loading…
Reference in a new issue