blob: effa7507f166187f9c13fa09f5c6cd6b5d5c1a22 [file] [log] [blame]
Qingsi Wang7685e862018-06-12 03:15:461/*
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 Chapovalov16cb1f62019-09-05 09:29:5917#include "api/rtc_event_log/rtc_event.h"
Danil Chapovalov83bbe912019-08-07 10:24:5318#include "api/rtc_event_log/rtc_event_log.h"
Danil Chapovalov4f281f12021-01-18 12:29:0019#include "rtc_base/synchronization/mutex.h"
20#include "rtc_base/thread_annotations.h"
Qingsi Wang7685e862018-06-12 03:15:4621
22namespace webrtc {
23
24class FakeRtcEventLog : public RtcEventLog {
25 public:
Danil Chapovalov4f281f12021-01-18 12:29:0026 FakeRtcEventLog() = default;
27 ~FakeRtcEventLog() override = default;
28
Qingsi Wang7685e862018-06-12 03:15:4629 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 Chapovalov4f281f12021-01-18 12:29:0033 int GetEventCount(RtcEvent::Type event_type);
Qingsi Wang7685e862018-06-12 03:15:4634
35 private:
Danil Chapovalov4f281f12021-01-18 12:29:0036 Mutex mu_;
37 std::map<RtcEvent::Type, int> count_ RTC_GUARDED_BY(mu_);
Qingsi Wang7685e862018-06-12 03:15:4638};
39
40} // namespace webrtc
41
42#endif // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_