Qingsi Wang | 7685e86 | 2018-06-12 03:15:46 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_ |
| 12 | #define LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_ |
| 13 | |
| 14 | #include <map> |
| 15 | #include <memory> |
| 16 | |
Danil Chapovalov | 16cb1f6 | 2019-09-05 09:29:59 | [diff] [blame] | 17 | #include "api/rtc_event_log/rtc_event.h" |
Danil Chapovalov | 83bbe91 | 2019-08-07 10:24:53 | [diff] [blame] | 18 | #include "api/rtc_event_log/rtc_event_log.h" |
Danil Chapovalov | 4f281f1 | 2021-01-18 12:29:00 | [diff] [blame] | 19 | #include "rtc_base/synchronization/mutex.h" |
| 20 | #include "rtc_base/thread_annotations.h" |
Qingsi Wang | 7685e86 | 2018-06-12 03:15:46 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class FakeRtcEventLog : public RtcEventLog { |
| 25 | public: |
Danil Chapovalov | 4f281f1 | 2021-01-18 12:29:00 | [diff] [blame] | 26 | FakeRtcEventLog() = default; |
| 27 | ~FakeRtcEventLog() override = default; |
| 28 | |
Qingsi Wang | 7685e86 | 2018-06-12 03:15:46 | [diff] [blame] | 29 | bool StartLogging(std::unique_ptr<RtcEventLogOutput> output, |
| 30 | int64_t output_period_ms) override; |
| 31 | void StopLogging() override; |
| 32 | void Log(std::unique_ptr<RtcEvent> event) override; |
Danil Chapovalov | 4f281f1 | 2021-01-18 12:29:00 | [diff] [blame] | 33 | int GetEventCount(RtcEvent::Type event_type); |
Qingsi Wang | 7685e86 | 2018-06-12 03:15:46 | [diff] [blame] | 34 | |
| 35 | private: |
Danil Chapovalov | 4f281f1 | 2021-01-18 12:29:00 | [diff] [blame] | 36 | Mutex mu_; |
| 37 | std::map<RtcEvent::Type, int> count_ RTC_GUARDED_BY(mu_); |
Qingsi Wang | 7685e86 | 2018-06-12 03:15:46 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace webrtc |
| 41 | |
| 42 | #endif // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_ |