From dd0601fbcf8d1851bc9df1c6a673fe1d4a7496c9 Mon Sep 17 00:00:00 2001 From: "tommi@webrtc.org" Date: Mon, 15 Dec 2014 09:47:49 +0000 Subject: [PATCH] Remove unneeded ctor and add a more practical one The default constructor isn't necessary, so I'm removing it. I'm adding another one so that we can (later) make |type| const. R=perkj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/36429004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7895 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/statstypes.cc | 5 +++++ talk/app/webrtc/statstypes.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/talk/app/webrtc/statstypes.cc b/talk/app/webrtc/statstypes.cc index 8547520069..0e67e700e3 100644 --- a/talk/app/webrtc/statstypes.cc +++ b/talk/app/webrtc/statstypes.cc @@ -53,6 +53,11 @@ StatsReport::StatsReport(const std::string& id) : id(id), timestamp(0) { } +StatsReport::StatsReport(const std::string& id, + const StatsReport::StatsType& type) + : id(id), type(type), timestamp(0) { +} + StatsReport& StatsReport::operator=(const StatsReport& src) { ASSERT(id == src.id); type = src.type; diff --git a/talk/app/webrtc/statstypes.h b/talk/app/webrtc/statstypes.h index d47dc18534..732396cd19 100644 --- a/talk/app/webrtc/statstypes.h +++ b/talk/app/webrtc/statstypes.h @@ -44,9 +44,8 @@ namespace webrtc { class StatsReport { public: - // TODO(tommi): Remove this ctor after removing reliance upon it in Chromium - // (mock_peer_connection_impl.cc). - StatsReport() : timestamp(0) {} + // TODO(tommi): Change this to be an enum. + typedef std::string StatsType; // TODO(tommi): Make protected and disallow copy completely once not needed. StatsReport(const StatsReport& src); @@ -54,6 +53,7 @@ class StatsReport { // Constructor is protected to force use of StatsSet. // TODO(tommi): Make this ctor protected. explicit StatsReport(const std::string& id); + StatsReport(const std::string& id, const StatsType& type); // TODO(tommi): Make this protected. StatsReport& operator=(const StatsReport& src); @@ -70,7 +70,7 @@ class StatsReport { // so it must never be changed. // TODO(tommi): Make this member variable const. std::string id; // See below for contents. - std::string type; // See below for contents. + StatsType type; // See below for contents. // StatsValue names. enum StatsValueName {