tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fake_rtc_event_log.h (1348B)


      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 <cstdint>
     15 #include <map>
     16 #include <memory>
     17 
     18 #include "api/rtc_event_log/rtc_event.h"
     19 #include "api/rtc_event_log/rtc_event_log.h"
     20 #include "api/rtc_event_log_output.h"
     21 #include "rtc_base/synchronization/mutex.h"
     22 #include "rtc_base/thread_annotations.h"
     23 
     24 namespace webrtc {
     25 
     26 class FakeRtcEventLog : public RtcEventLog {
     27 public:
     28  FakeRtcEventLog() = default;
     29  ~FakeRtcEventLog() override = default;
     30 
     31  bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
     32                    int64_t output_period_ms) override;
     33  void StopLogging() override;
     34  void Log(std::unique_ptr<RtcEvent> event) override;
     35  int GetEventCount(RtcEvent::Type event_type);
     36 
     37 private:
     38  Mutex mu_;
     39  std::map<RtcEvent::Type, int> count_ RTC_GUARDED_BY(mu_);
     40 };
     41 
     42 }  // namespace webrtc
     43 
     44 #endif  // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_