Chromium Code Reviews| Index: talk/app/webrtc/fakemetricsobserver.h |
| diff --git a/talk/app/webrtc/dtlsidentityservice.h b/talk/app/webrtc/fakemetricsobserver.h |
| similarity index 53% |
| copy from talk/app/webrtc/dtlsidentityservice.h |
| copy to talk/app/webrtc/fakemetricsobserver.h |
| index 760cab45651dd505731be490fbbc73fef1d4e07a..439d8c1a46bd95fb6ae25235d06ef0ff624fe271 100644 |
| --- a/talk/app/webrtc/dtlsidentityservice.h |
| +++ b/talk/app/webrtc/fakemetricsobserver.h |
| @@ -25,35 +25,52 @@ |
| * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef TALK_APP_WEBRTC_DTLSIDENTITYSERVICE_H_ |
| -#define TALK_APP_WEBRTC_DTLSIDENTITYSERVICE_H_ |
| +#ifndef TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |
| +#define TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |
| +#include <map> |
| #include <string> |
| #include "talk/app/webrtc/peerconnectioninterface.h" |
| namespace webrtc { |
| -class DtlsIdentityStore; |
| - |
| -// This class forwards the request to DtlsIdentityStore to generate the |
| -// identity. |
| -class DtlsIdentityService : public webrtc::DTLSIdentityServiceInterface { |
| +class FakeMetricsObserver : public MetricsObserverInterface { |
| public: |
| - explicit DtlsIdentityService(DtlsIdentityStore* store) : store_(store) {} |
| - |
| - // DTLSIdentityServiceInterface impl. |
| - // |identity_name| and |common_name| must equal to |
| - // DtlsIdentityStore::kIdentityName, otherwise the request will fail and false |
| - // will be returned. |
| - bool RequestIdentity(const std::string& identity_name, |
| - const std::string& common_name, |
| - webrtc::DTLSIdentityRequestObserver* observer) override; |
| - |
| - private: |
| - DtlsIdentityStore* store_; |
| + FakeMetricsObserver() { Reset(); } |
| + void Reset() { |
| + memset(peer_connection_metrics_counters_, 0, |
| + sizeof(peer_connection_metrics_counters_)); |
| + memset(peer_connection_metrics_name_, 0, |
| + sizeof(peer_connection_metrics_name_)); |
| + for (std::string& type : peer_connection_metrics_name_string_) { |
| + type.clear(); |
| + } |
| + } |
| + |
| + void IncrementCounter(PeerConnectionMetricsCounter type) override { |
| + peer_connection_metrics_counters_[type]++; |
| + } |
| + void AddHistogramSample(PeerConnectionMetricsName type, |
| + int value) override { |
| + ASSERT(peer_connection_metrics_name_[type] == 0); |
| + peer_connection_metrics_name_[type] = value; |
| + } |
| + void AddHistogramSample(PeerConnectionMetricsName type, |
| + const std::string& value) override { |
| + peer_connection_metrics_name_string_[type] = value; |
| + } |
| + |
| + int peer_connection_metrics_counters_ |
| + [kPeerConnectionMetricsCounter_Max]; |
| + int peer_connection_metrics_name_[kPeerConnectionMetricsCounter_Max]; |
|
juberti1
2015/07/01 02:06:15
Realize that you didn't write most of this code, b
joachim
2015/07/01 14:18:42
Renamed, made private and provided accessors. Chan
|
| + std::string peer_connection_metrics_name_string_ |
| + [kPeerConnectionMetricsName_Max]; |
| + |
| + int AddRef() override { return 1; } |
| + int Release() override { return 1; } |
| }; |
| } // namespace webrtc |
| -#endif // TALK_APP_WEBRTC_DTLSIDENTITYSERVICE_H_ |
| +#endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |