From ecb8723402f2c138466ff9dc2ecc8626b7fb3db5 Mon Sep 17 00:00:00 2001 From: "tommi@webrtc.org" Date: Tue, 8 Jul 2014 12:48:29 +0000 Subject: [PATCH] Change Timing::WallTimeNow to be static. There's no need to construct a Timing object to call this method. On Windows we were unnecessarily calling CreateWaitableTimer + CloseHandle but never actually using that waitable timer. There's otherwise no change in functionality. R=xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/20869004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6624 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/statscollector.cc | 3 ++- talk/app/webrtc/statscollector.h | 3 --- talk/base/timing.cc | 1 + talk/base/timing.h | 3 ++- webrtc/base/timing.cc | 1 + webrtc/base/timing.h | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/talk/app/webrtc/statscollector.cc b/talk/app/webrtc/statscollector.cc index 86a88c159f..74fc3a72ec 100644 --- a/talk/app/webrtc/statscollector.cc +++ b/talk/app/webrtc/statscollector.cc @@ -32,6 +32,7 @@ #include "talk/base/base64.h" #include "talk/base/scoped_ptr.h" +#include "talk/base/timing.h" #include "talk/session/media/channel.h" namespace webrtc { @@ -924,7 +925,7 @@ void StatsCollector::ExtractVideoInfo( } double StatsCollector::GetTimeNow() { - return timing_.WallTimeNow() * talk_base::kNumMillisecsPerSec; + return talk_base::Timing::WallTimeNow() * talk_base::kNumMillisecsPerSec; } bool StatsCollector::GetTransportIdFromProxy(const std::string& proxy, diff --git a/talk/app/webrtc/statscollector.h b/talk/app/webrtc/statscollector.h index 77a1ba086d..251690455d 100644 --- a/talk/app/webrtc/statscollector.h +++ b/talk/app/webrtc/statscollector.h @@ -40,8 +40,6 @@ #include "talk/app/webrtc/statstypes.h" #include "talk/app/webrtc/webrtcsession.h" -#include "talk/base/timing.h" - namespace webrtc { class StatsCollector { @@ -130,7 +128,6 @@ class StatsCollector { // Raw pointer to the session the statistics are gathered from. WebRtcSession* session_; double stats_gathering_started_; - talk_base::Timing timing_; cricket::ProxyTransportMap proxy_to_transport_; typedef std::vector > diff --git a/talk/base/timing.cc b/talk/base/timing.cc index 4df9f1f346..0b55eaf8c5 100644 --- a/talk/base/timing.cc +++ b/talk/base/timing.cc @@ -63,6 +63,7 @@ Timing::~Timing() { #endif } +// static double Timing::WallTimeNow() { #if defined(POSIX) struct timeval time; diff --git a/talk/base/timing.h b/talk/base/timing.h index f2bf0130ba..2112e862d6 100644 --- a/talk/base/timing.h +++ b/talk/base/timing.h @@ -41,7 +41,8 @@ class Timing { // WallTimeNow() returns the current wall-clock time in seconds, // within 10 milliseconds resolution. - virtual double WallTimeNow(); + // WallTimeNow is static and does not require a timer_handle_ on Windows. + static double WallTimeNow(); // TimerNow() is like WallTimeNow(), but is monotonically // increasing. It returns seconds in resolution of 10 microseconds diff --git a/webrtc/base/timing.cc b/webrtc/base/timing.cc index aa1fc4290b..0c5ed5e12c 100644 --- a/webrtc/base/timing.cc +++ b/webrtc/base/timing.cc @@ -46,6 +46,7 @@ Timing::~Timing() { #endif } +// static double Timing::WallTimeNow() { #if defined(WEBRTC_POSIX) struct timeval time; diff --git a/webrtc/base/timing.h b/webrtc/base/timing.h index 58b17a9fb7..1dee607617 100644 --- a/webrtc/base/timing.h +++ b/webrtc/base/timing.h @@ -24,7 +24,8 @@ class Timing { // WallTimeNow() returns the current wall-clock time in seconds, // within 10 milliseconds resolution. - virtual double WallTimeNow(); + // WallTimeNow is static and does not require a timer_handle_ on Windows. + static double WallTimeNow(); // TimerNow() is like WallTimeNow(), but is monotonically // increasing. It returns seconds in resolution of 10 microseconds