| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 class FakeMetricsObserver : public MetricsObserverInterface { | 39 class FakeMetricsObserver : public MetricsObserverInterface { |
| 40 public: | 40 public: |
| 41 FakeMetricsObserver(); | 41 FakeMetricsObserver(); |
| 42 void Reset(); | 42 void Reset(); |
| 43 | 43 |
| 44 void IncrementEnumCounter(PeerConnectionEnumCounterType, | 44 void IncrementEnumCounter(PeerConnectionEnumCounterType, |
| 45 int counter, | 45 int counter, |
| 46 int counter_max) override; | 46 int counter_max) override; |
| 47 void AddHistogramSample(PeerConnectionMetricsName type, | 47 void AddHistogramSample(PeerConnectionMetricsName type, |
| 48 int value) override; | 48 int value) override; |
| 49 void AddHistogramSample(PeerConnectionMetricsName type, |
| 50 const std::string& value) override; |
| 49 | 51 |
| 50 // Accessors to be used by the tests. | 52 // Accessors to be used by the tests. |
| 51 int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; | 53 int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; |
| 52 int GetHistogramSample(PeerConnectionMetricsName type) const; | 54 int GetIntHistogramSample(PeerConnectionMetricsName type) const; |
| 55 const std::string& GetStringHistogramSample( |
| 56 PeerConnectionMetricsName type) const; |
| 53 | 57 |
| 54 protected: | 58 protected: |
| 55 ~FakeMetricsObserver() {} | 59 ~FakeMetricsObserver() {} |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 rtc::ThreadChecker thread_checker_; | 62 rtc::ThreadChecker thread_checker_; |
| 59 // The vector contains maps for each counter type. In the map, it's a mapping | 63 // This is a 2 dimension array. The first index is the enum counter type. The |
| 60 // from individual counter to its count, such that it's memory efficient when | 64 // 2nd index is the counter of that particular enum counter type. |
| 61 // comes to sparse enum types, like the SSL ciphers in the IANA registry. | 65 std::vector<std::vector<int>> counters_; |
| 62 std::vector<std::map<int, int>> counters_; | 66 int int_histogram_samples_[kPeerConnectionMetricsName_Max]; |
| 63 int histogram_samples_[kPeerConnectionMetricsName_Max]; | 67 std::string string_histogram_samples_[kPeerConnectionMetricsName_Max]; |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace webrtc | 70 } // namespace webrtc |
| 67 | 71 |
| 68 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ | 72 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |
| OLD | NEW |