File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,24 @@ class NoopStats : public Stats {
19
19
void bytesRead (size_t bytes) override {};
20
20
void frameWritten (const std::string& frameType) override {};
21
21
void frameRead (const std::string& frameType) override {};
22
+
23
+ static NoopStats& instance (void ) {
24
+ static NoopStats singleton;
25
+ return singleton;
26
+ }
27
+
28
+ protected:
29
+ NoopStats () = default ;
30
+ ~NoopStats () = default ;
31
+
32
+ private:
33
+ NoopStats (const NoopStats& other) = delete ; // non construction-copyable
34
+ NoopStats& operator =(const NoopStats&) = delete ; // non copyable
35
+ NoopStats& operator =(const NoopStats&&) = delete ; // non movable
36
+ NoopStats (const NoopStats&&) = delete ; // non construction-movable
22
37
};
23
38
24
39
Stats& Stats::noop () {
25
- static NoopStats noop_;
26
- return noop_;
40
+ return NoopStats::instance ();
27
41
};
28
42
}
Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ InlineConnection::InlineConnection()
20
20
21
21
InlineConnection::~InlineConnection () {}
22
22
23
- void InlineConnection::connectTo (
24
- InlineConnection& other) {
23
+ void InlineConnection::connectTo (InlineConnection& other) {
25
24
ASSERT_FALSE (other_);
26
25
ASSERT_FALSE (other.other_ );
27
26
other.other_ = this ;
You can’t perform that action at this time.
0 commit comments