summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-27 20:43:33 +0000
committerdsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-27 20:43:33 +0000
commite1acf6f902e50222baf99bfb492ecc38a1604975 (patch)
tree503d45705b14be7e2f1ed86c71d6064abbf90fbe /base
parenta2f5993e1ce940e8a8eec900abaeed02e2eee09b (diff)
downloadchromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.zip
chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.gz
chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.bz2
Move Time, TimeDelta and TimeTicks into namespace base.
Review URL: http://codereview.chromium.org/7995 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/condition_variable.h2
-rw-r--r--base/condition_variable_posix.cc3
-rw-r--r--base/condition_variable_unittest.cc3
-rw-r--r--base/condition_variable_win.cc2
-rw-r--r--base/field_trial.cc2
-rw-r--r--base/field_trial.h6
-rw-r--r--base/histogram.cc2
-rw-r--r--base/histogram.h20
-rw-r--r--base/histogram_unittest.cc2
-rw-r--r--base/idletimer_unittest.cc2
-rw-r--r--base/message_loop.cc3
-rw-r--r--base/message_loop.h10
-rw-r--r--base/message_loop_unittest.cc2
-rw-r--r--base/message_pump.h5
-rw-r--r--base/message_pump_default.cc1
-rw-r--r--base/message_pump_default.h1
-rw-r--r--base/message_pump_libevent.cc1
-rw-r--r--base/message_pump_libevent.h1
-rw-r--r--base/message_pump_win.cc2
-rw-r--r--base/message_pump_win.h1
-rw-r--r--base/observer_list_unittest.cc2
-rw-r--r--base/perftimer.h8
-rw-r--r--base/pr_time_unittest.cc2
-rw-r--r--base/spin_wait.h12
-rw-r--r--base/stats_counters.h14
-rw-r--r--base/stats_table_unittest.cc2
-rw-r--r--base/time.cc3
-rw-r--r--base/time.h4
-rw-r--r--base/time_format.cc2
-rw-r--r--base/time_format.h5
-rw-r--r--base/time_posix.cc4
-rw-r--r--base/time_unittest.cc4
-rw-r--r--base/time_unittest_win.cc4
-rw-r--r--base/time_win.cc4
-rw-r--r--base/timer_unittest.cc2
-rw-r--r--base/trace_event.cc1
-rw-r--r--base/tracked.cc2
-rw-r--r--base/tracked.h2
-rw-r--r--base/tracked_objects.cc2
-rw-r--r--base/tracked_objects.h10
-rw-r--r--base/waitable_event.h5
-rw-r--r--base/waitable_event_generic.cc1
-rw-r--r--base/waitable_event_unittest.cc1
-rw-r--r--base/waitable_event_win.cc1
-rw-r--r--base/watchdog.cc4
-rw-r--r--base/watchdog.h14
-rw-r--r--base/watchdog_unittest.cc2
47 files changed, 121 insertions, 67 deletions
diff --git a/base/condition_variable.h b/base/condition_variable.h
index 9307d8c..bceef5e 100644
--- a/base/condition_variable.h
+++ b/base/condition_variable.h
@@ -80,7 +80,7 @@ class ConditionVariable {
// Wait() releases the caller's critical section atomically as it starts to
// sleep, and the reacquires it when it is signaled.
void Wait();
- void TimedWait(const TimeDelta& max_time);
+ void TimedWait(const base::TimeDelta& max_time);
// Broadcast() revives all waiting threads.
void Broadcast();
diff --git a/base/condition_variable_posix.cc b/base/condition_variable_posix.cc
index c6f5f07..7a7f5dd 100644
--- a/base/condition_variable_posix.cc
+++ b/base/condition_variable_posix.cc
@@ -11,6 +11,9 @@
#include "base/lock_impl.h"
#include "base/logging.h"
+using base::Time;
+using base::TimeDelta;
+
ConditionVariable::ConditionVariable(Lock* user_lock)
: user_mutex_(user_lock->lock_impl()->os_lock()) {
int rv = pthread_cond_init(&condition_, NULL);
diff --git a/base/condition_variable_unittest.cc b/base/condition_variable_unittest.cc
index 219944e..ee5d1c5 100644
--- a/base/condition_variable_unittest.cc
+++ b/base/condition_variable_unittest.cc
@@ -16,6 +16,9 @@
#include "base/spin_wait.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::TimeDelta;
+using base::TimeTicks;
+
namespace {
//------------------------------------------------------------------------------
// Define our test class, with several common variables.
diff --git a/base/condition_variable_win.cc b/base/condition_variable_win.cc
index ba4baf7..5284133 100644
--- a/base/condition_variable_win.cc
+++ b/base/condition_variable_win.cc
@@ -9,6 +9,8 @@
#include "base/lock.h"
#include "base/logging.h"
+using base::TimeDelta;
+
ConditionVariable::ConditionVariable(Lock* user_lock)
: user_lock_(*user_lock),
run_state_(RUNNING),
diff --git a/base/field_trial.cc b/base/field_trial.cc
index 103e539..9fd9d8f 100644
--- a/base/field_trial.cc
+++ b/base/field_trial.cc
@@ -7,6 +7,8 @@
#include "base/logging.h"
#include "base/rand_util.h"
+using base::Time;
+
//------------------------------------------------------------------------------
// FieldTrialList methods and members.
diff --git a/base/field_trial.h b/base/field_trial.h
index a812d4d..99e213c 100644
--- a/base/field_trial.h
+++ b/base/field_trial.h
@@ -70,11 +70,11 @@ class FieldTrialList : NonThreadSafe {
// of the application. In some experiments it may be useful to discount
// data that is gathered before the application has reach sufficient
// stability (example: most DLL have loaded, etc.)
- static Time application_start_time() {
+ static base::Time application_start_time() {
if (global_)
return global_->application_start_time_;
// For testing purposes only, or when we don't yet have a start time.
- return Time::Now();
+ return base::Time::Now();
}
private:
@@ -86,7 +86,7 @@ class FieldTrialList : NonThreadSafe {
static FieldTrialList* global_; // The singleton of this class.
static int constructor_count_; // Prevent having more than one.
- Time application_start_time_;
+ base::Time application_start_time_;
RegistrationList registered_;
DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
diff --git a/base/histogram.cc b/base/histogram.cc
index 19dcf83..384716d 100644
--- a/base/histogram.cc
+++ b/base/histogram.cc
@@ -16,6 +16,8 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+using base::TimeDelta;
+
typedef Histogram::Count Count;
// static
diff --git a/base/histogram.h b/base/histogram.h
index a7c1b92..af5f1fd 100644
--- a/base/histogram.h
+++ b/base/histogram.h
@@ -44,8 +44,8 @@
// These macros all use 50 buckets.
#define HISTOGRAM_TIMES(name, sample) do { \
- static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
- TimeDelta::FromSeconds(10), 50); \
+ static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
+ base::TimeDelta::FromSeconds(10), 50); \
counter.AddTime(sample); \
} while (0)
@@ -103,16 +103,16 @@
static const int kUmaTargetedHistogramFlag = 0x1;
#define UMA_HISTOGRAM_TIMES(name, sample) do { \
- static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
- TimeDelta::FromSeconds(10), 50); \
+ static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
+ base::TimeDelta::FromSeconds(10), 50); \
counter.SetFlags(kUmaTargetedHistogramFlag); \
counter.AddTime(sample); \
} while (0)
// Use this macro when times can routinely be much longer than 10 seconds.
#define UMA_HISTOGRAM_LONG_TIMES(name, sample) do { \
- static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
- TimeDelta::FromHours(1), 50); \
+ static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
+ base::TimeDelta::FromHours(1), 50); \
counter.SetFlags(kUmaTargetedHistogramFlag); \
counter.AddTime(sample); \
} while (0)
@@ -191,8 +191,8 @@ class Histogram : public StatsRate {
Histogram(const wchar_t* name, Sample minimum,
Sample maximum, size_t bucket_count);
- Histogram(const wchar_t* name, TimeDelta minimum,
- TimeDelta maximum, size_t bucket_count);
+ Histogram(const wchar_t* name, base::TimeDelta minimum,
+ base::TimeDelta maximum, size_t bucket_count);
virtual ~Histogram();
// Hooks to override stats counter methods. This ensures that we gather all
@@ -330,8 +330,8 @@ class LinearHistogram : public Histogram {
};
LinearHistogram(const wchar_t* name, Sample minimum,
Sample maximum, size_t bucket_count);
- LinearHistogram(const wchar_t* name, TimeDelta minimum,
- TimeDelta maximum, size_t bucket_count);
+ LinearHistogram(const wchar_t* name, base::TimeDelta minimum,
+ base::TimeDelta maximum, size_t bucket_count);
~LinearHistogram() {}
// Store a list of number/text values for use in rendering the histogram.
diff --git a/base/histogram_unittest.cc b/base/histogram_unittest.cc
index 092d0543..7085f97 100644
--- a/base/histogram_unittest.cc
+++ b/base/histogram_unittest.cc
@@ -10,6 +10,8 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::TimeDelta;
+
namespace {
class HistogramTest : public testing::Test {
diff --git a/base/idletimer_unittest.cc b/base/idletimer_unittest.cc
index fe723b6..dda7468 100644
--- a/base/idletimer_unittest.cc
+++ b/base/idletimer_unittest.cc
@@ -6,6 +6,8 @@
#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::Time;
+using base::TimeDelta;
using base::IdleTimer;
namespace {
diff --git a/base/message_loop.cc b/base/message_loop.cc
index cc87fe6..73cb7da 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -23,6 +23,9 @@
#include "base/message_pump_glib.h"
#endif
+using base::Time;
+using base::TimeDelta;
+
// A lazily created thread local storage for quick access to a thread's message
// loop, if one exists. This should be safe and free of static constructors.
static base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr(
diff --git a/base/message_loop.h b/base/message_loop.h
index 4ca6fae..2d38853 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -256,10 +256,10 @@ class MessageLoop : public base::MessagePump::Delegate {
// This structure is copied around by value.
struct PendingTask {
- Task* task; // The task to run.
- Time delayed_run_time; // The time when the task should be run.
- int sequence_num; // Used to facilitate sorting by run time.
- bool nestable; // True if OK to dispatch from a nested loop.
+ Task* task; // The task to run.
+ base::Time delayed_run_time; // The time when the task should be run.
+ int sequence_num; // Used to facilitate sorting by run time.
+ bool nestable; // True if OK to dispatch from a nested loop.
PendingTask(Task* task, bool nestable)
: task(task), sequence_num(0), nestable(nestable) {
@@ -334,7 +334,7 @@ class MessageLoop : public base::MessagePump::Delegate {
// base::MessagePump::Delegate methods:
virtual bool DoWork();
- virtual bool DoDelayedWork(Time* next_delayed_work_time);
+ virtual bool DoDelayedWork(base::Time* next_delayed_work_time);
virtual bool DoIdleWork();
// Start recording histogram info about events and action IF it was enabled
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index b742d76..83be2b1 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -15,6 +15,8 @@
#endif
using base::Thread;
+using base::Time;
+using base::TimeDelta;
// TODO(darin): Platform-specific MessageLoop tests should be grouped together
// to avoid chopping this file up with so many #ifdefs.
diff --git a/base/message_pump.h b/base/message_pump.h
index da4d214..1a7770e 100644
--- a/base/message_pump.h
+++ b/base/message_pump.h
@@ -7,10 +7,10 @@
#include "base/ref_counted.h"
-class Time;
-
namespace base {
+class Time;
+
class MessagePump : public RefCountedThreadSafe<MessagePump> {
public:
// Please see the comments above the Run method for an illustration of how
@@ -120,4 +120,3 @@ class MessagePump : public RefCountedThreadSafe<MessagePump> {
} // namespace base
#endif // BASE_MESSAGE_PUMP_H_
-
diff --git a/base/message_pump_default.cc b/base/message_pump_default.cc
index d1ecd12..d69fc03 100644
--- a/base/message_pump_default.cc
+++ b/base/message_pump_default.cc
@@ -75,4 +75,3 @@ void MessagePumpDefault::ScheduleDelayedWork(const Time& delayed_work_time) {
}
} // namespace base
-
diff --git a/base/message_pump_default.h b/base/message_pump_default.h
index f565518..aa0dab9 100644
--- a/base/message_pump_default.h
+++ b/base/message_pump_default.h
@@ -38,4 +38,3 @@ class MessagePumpDefault : public MessagePump {
} // namespace base
#endif // BASE_MESSAGE_PUMP_DEFAULT_H_
-
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 12cb6d1..0dd533e 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -179,4 +179,3 @@ void MessagePumpLibevent::ScheduleDelayedWork(const Time& delayed_work_time) {
}
} // namespace base
-
diff --git a/base/message_pump_libevent.h b/base/message_pump_libevent.h
index 7534e50..9934f31 100644
--- a/base/message_pump_libevent.h
+++ b/base/message_pump_libevent.h
@@ -86,4 +86,3 @@ class MessagePumpLibevent : public MessagePump {
} // namespace base
#endif // BASE_MESSAGE_PUMP_LIBEVENT_H_
-
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc
index 4eb0995..542fcf1 100644
--- a/base/message_pump_win.cc
+++ b/base/message_pump_win.cc
@@ -9,6 +9,8 @@
#include "base/histogram.h"
#include "base/win_util.h"
+using base::Time;
+
namespace {
class HandlerData : public base::MessagePumpForIO::Watcher {
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index 50a5223..eb4253f 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -249,4 +249,3 @@ class MessagePumpForIO : public MessagePumpWin {
} // namespace base
#endif // BASE_MESSAGE_PUMP_WIN_H_
-
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 529e8a9..8f69256 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -9,6 +9,8 @@
#include "base/ref_counted.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::Time;
+
namespace {
class ObserverListTest : public testing::Test {
diff --git a/base/perftimer.h b/base/perftimer.h
index 86314e9..9558697 100644
--- a/base/perftimer.h
+++ b/base/perftimer.h
@@ -31,16 +31,16 @@ void LogPerfResult(const char* test_name, double value, const char* units);
class PerfTimer {
public:
PerfTimer() {
- begin_ = TimeTicks::Now();
+ begin_ = base::TimeTicks::Now();
}
// Returns the time elapsed since object construction
- TimeDelta Elapsed() const {
- return TimeTicks::Now() - begin_;
+ base::TimeDelta Elapsed() const {
+ return base::TimeTicks::Now() - begin_;
}
private:
- TimeTicks begin_;
+ base::TimeTicks begin_;
};
// ----------------------------------------------------------------------
diff --git a/base/pr_time_unittest.cc b/base/pr_time_unittest.cc
index 38c3140..3b096a2 100644
--- a/base/pr_time_unittest.cc
+++ b/base/pr_time_unittest.cc
@@ -9,6 +9,8 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::Time;
+
namespace {
// time_t representation of 15th Oct 2007 12:45:00 PDT
diff --git a/base/spin_wait.h b/base/spin_wait.h
index 86818af..36ae083 100644
--- a/base/spin_wait.h
+++ b/base/spin_wait.h
@@ -31,14 +31,15 @@
// that the test passes, even if load varies, and external events vary.
#define SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(expression) \
- SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromSeconds(1), (expression))
+ SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(base::TimeDelta::FromSeconds(1), \
+ (expression))
#define SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(delta, expression) do { \
- Time start = Time::Now(); \
- const TimeDelta kTimeout = delta; \
+ base::Time start = base::Time::Now(); \
+ const base::TimeDelta kTimeout = delta; \
while(!(expression)) { \
- if (kTimeout < Time::Now() - start) { \
- EXPECT_LE((Time::Now() - start).InMilliseconds(), \
+ if (kTimeout < base::Time::Now() - start) { \
+ EXPECT_LE((base::Time::Now() - start).InMilliseconds(), \
kTimeout.InMilliseconds()) << "Timed out"; \
break; \
} \
@@ -48,4 +49,3 @@
while(0)
#endif // BASE_SPIN_WAIT_H__
-
diff --git a/base/stats_counters.h b/base/stats_counters.h
index eaff1b4..5dc7b89c 100644
--- a/base/stats_counters.h
+++ b/base/stats_counters.h
@@ -187,15 +187,15 @@ class StatsCounterTimer : protected StatsCounter {
void Start() {
if (!Enabled())
return;
- start_time_ = TimeTicks::Now();
- stop_time_ = TimeTicks();
+ start_time_ = base::TimeTicks::Now();
+ stop_time_ = base::TimeTicks();
}
// Stop the timer and record the results.
void Stop() {
if (!Enabled() || !Running())
return;
- stop_time_ = TimeTicks::Now();
+ stop_time_ = base::TimeTicks::Now();
Record();
}
@@ -205,12 +205,12 @@ class StatsCounterTimer : protected StatsCounter {
}
// Accept a TimeDelta to increment.
- virtual void AddTime(TimeDelta time) {
+ virtual void AddTime(base::TimeDelta time) {
Add(static_cast<int>(time.InMilliseconds()));
}
// TODO(jar) temporary hack include method till base and chrome use new name.
- void IncrementTimer(TimeDelta time) {
+ void IncrementTimer(base::TimeDelta time) {
AddTime(time);
}
@@ -220,8 +220,8 @@ class StatsCounterTimer : protected StatsCounter {
AddTime(stop_time_ - start_time_);
}
- TimeTicks start_time_;
- TimeTicks stop_time_;
+ base::TimeTicks start_time_;
+ base::TimeTicks stop_time_;
};
// A StatsRate is a timer that keeps a count of the number of intervals added so
diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc
index 7d5f015..c6e53e9 100644
--- a/base/stats_table_unittest.cc
+++ b/base/stats_table_unittest.cc
@@ -14,6 +14,8 @@
#include <windows.h>
#endif
+using base::TimeTicks;
+
namespace {
class StatsTableTest : public MultiProcessTest {
};
diff --git a/base/time.cc b/base/time.cc
index 38f732c..83b5c09 100644
--- a/base/time.cc
+++ b/base/time.cc
@@ -8,6 +8,8 @@
#include "base/logging.h"
+namespace base {
+
// TimeDelta ------------------------------------------------------------------
// static
@@ -120,3 +122,4 @@ bool Time::FromString(const wchar_t* time_string, Time* parsed_time) {
return true;
}
+} // namespace base
diff --git a/base/time.h b/base/time.h
index 4141116..cb0eeb8 100644
--- a/base/time.h
+++ b/base/time.h
@@ -33,6 +33,8 @@
#include <windows.h>
#endif
+namespace base {
+
class Time;
class TimeTicks;
@@ -438,4 +440,6 @@ inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
return TimeTicks(t.ticks_ + delta_);
}
+} // namespace base
+
#endif // BASE_TIME_H_
diff --git a/base/time_format.cc b/base/time_format.cc
index 230c24e..0cd4eba 100644
--- a/base/time_format.cc
+++ b/base/time_format.cc
@@ -9,6 +9,8 @@
#include "base/time.h"
#include "unicode/datefmt.h"
+using base::Time;
+
namespace {
std::wstring TimeFormat(const DateFormat* formatter,
diff --git a/base/time_format.h b/base/time_format.h
index af44897..b51c768 100644
--- a/base/time_format.h
+++ b/base/time_format.h
@@ -10,10 +10,10 @@
#include <string>
-class Time;
-
namespace base {
+class Time;
+
// Returns the time of day, e.g., "3:07 PM".
std::wstring TimeFormatTimeOfDay(const Time& time);
@@ -38,4 +38,3 @@ std::wstring TimeFormatFriendlyDate(const Time& time);
} // namespace base
#endif // BASE_TIME_FORMAT_H_
-
diff --git a/base/time_posix.cc b/base/time_posix.cc
index 18dc240..901b65c 100644
--- a/base/time_posix.cc
+++ b/base/time_posix.cc
@@ -13,6 +13,8 @@
#include "base/basictypes.h"
#include "base/logging.h"
+namespace base {
+
// The Time routines in this file use standard POSIX routines, or almost-
// standard routines in the case of timegm. We need to use a Mach-specific
// function for TimeTicks::Now() on Mac OS X.
@@ -140,3 +142,5 @@ TimeTicks TimeTicks::Now() {
TimeTicks TimeTicks::HighResNow() {
return Now();
}
+
+} // namespace base
diff --git a/base/time_unittest.cc b/base/time_unittest.cc
index db0990f4..ebe69eb 100644
--- a/base/time_unittest.cc
+++ b/base/time_unittest.cc
@@ -9,6 +9,10 @@
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::Time;
+using base::TimeDelta;
+using base::TimeTicks;
+
// Test conversions to/from time_t and exploding/unexploding.
TEST(Time, TimeT) {
// C library time and exploded time.
diff --git a/base/time_unittest_win.cc b/base/time_unittest_win.cc
index 1c3ea08..d0f606d4 100644
--- a/base/time_unittest_win.cc
+++ b/base/time_unittest_win.cc
@@ -9,6 +9,10 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::Time;
+using base::TimeDelta;
+using base::TimeTicks;
+
namespace {
class MockTimeTicks : public TimeTicks {
diff --git a/base/time_win.cc b/base/time_win.cc
index e7d7ae8..bc9d0c7 100644
--- a/base/time_win.cc
+++ b/base/time_win.cc
@@ -47,6 +47,10 @@
#include "base/singleton.h"
#include "base/system_monitor.h"
+using base::Time;
+using base::TimeDelta;
+using base::TimeTicks;
+
namespace {
// From MSDN, FILETIME "Contains a 64-bit value representing the number of
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc
index a9d13e2..face9c8 100644
--- a/base/timer_unittest.cc
+++ b/base/timer_unittest.cc
@@ -7,6 +7,8 @@
#include "base/timer.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::TimeDelta;
+
namespace {
class OneShotTimerTester {
diff --git a/base/trace_event.cc b/base/trace_event.cc
index 972f17c..fa47184 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -150,4 +150,3 @@ void TraceLog::Log(const std::string& msg) {
}
} // namespace base
-
diff --git a/base/tracked.cc b/base/tracked.cc
index b47a4e4..5e519b1 100644
--- a/base/tracked.cc
+++ b/base/tracked.cc
@@ -7,6 +7,8 @@
#include "base/string_util.h"
#include "base/tracked_objects.h"
+using base::Time;
+
namespace tracked_objects {
//------------------------------------------------------------------------------
diff --git a/base/tracked.h b/base/tracked.h
index f976175..002b858 100644
--- a/base/tracked.h
+++ b/base/tracked.h
@@ -116,7 +116,7 @@ class Tracked {
// The time this object was constructed. If its life consisted of a long
// waiting period, and then it became active, then this value is generally
// reset before the object begins it active life.
- Time tracked_birth_time_;
+ base::Time tracked_birth_time_;
#endif // TRACK_ALL_TASK_OBJECTS
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index c9e8eb0..4102075 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -8,6 +8,8 @@
#include "base/string_util.h"
+using base::TimeDelta;
+
namespace tracked_objects {
// A TLS slot to the TrackRegistry for the current thread.
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 2e6f046..638ea24 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -80,11 +80,11 @@ class DeathData {
// a corrosponding death.
explicit DeathData(int count) : count_(count), square_duration_(0) {}
- void RecordDeath(const TimeDelta& duration);
+ void RecordDeath(const base::TimeDelta& duration);
// Metrics accessors.
int count() const { return count_; }
- TimeDelta life_duration() const { return life_duration_; }
+ base::TimeDelta life_duration() const { return life_duration_; }
int64 square_duration() const { return square_duration_; }
int AverageMsDuration() const;
double StandardDeviation() const;
@@ -99,7 +99,7 @@ class DeathData {
private:
int count_; // Number of destructions.
- TimeDelta life_duration_; // Sum of all lifetime durations.
+ base::TimeDelta life_duration_; // Sum of all lifetime durations.
int64 square_duration_; // Sum of squares in milliseconds.
};
@@ -128,7 +128,7 @@ class Snapshot {
const std::string DeathThreadName() const;
int count() const { return death_data_.count(); }
- TimeDelta life_duration() const { return death_data_.life_duration(); }
+ base::TimeDelta life_duration() const { return death_data_.life_duration(); }
int64 square_duration() const { return death_data_.square_duration(); }
int AverageMsDuration() const { return death_data_.AverageMsDuration(); }
@@ -339,7 +339,7 @@ class ThreadData {
Births* FindLifetime(const Location& location);
// Find a place to record a death on this thread.
- void TallyADeath(const Births& lifetimes, const TimeDelta& duration);
+ void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration);
// (Thread safe) Get start of list of instances.
static ThreadData* first();
diff --git a/base/waitable_event.h b/base/waitable_event.h
index 3aa42d4..b723653 100644
--- a/base/waitable_event.h
+++ b/base/waitable_event.h
@@ -14,10 +14,10 @@ typedef void* HANDLE;
#include "base/lock.h"
#endif
-class TimeDelta;
-
namespace base {
+class TimeDelta;
+
// A WaitableEvent can be a useful thread synchronization tool when you want to
// allow one thread to wait for another thread to finish some work.
//
@@ -80,4 +80,3 @@ class WaitableEvent {
} // namespace base
#endif // BASE_WAITABLE_EVENT_H_
-
diff --git a/base/waitable_event_generic.cc b/base/waitable_event_generic.cc
index 6afbf18..61eeeb8 100644
--- a/base/waitable_event_generic.cc
+++ b/base/waitable_event_generic.cc
@@ -69,4 +69,3 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
}
} // namespace base
-
diff --git a/base/waitable_event_unittest.cc b/base/waitable_event_unittest.cc
index 9dc9335..e7bab49 100644
--- a/base/waitable_event_unittest.cc
+++ b/base/waitable_event_unittest.cc
@@ -6,6 +6,7 @@
#include "base/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::TimeDelta;
using base::WaitableEvent;
namespace {
diff --git a/base/waitable_event_win.cc b/base/waitable_event_win.cc
index 8c1efe6..257f145 100644
--- a/base/waitable_event_win.cc
+++ b/base/waitable_event_win.cc
@@ -63,4 +63,3 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
}
} // namespace base
-
diff --git a/base/watchdog.cc b/base/watchdog.cc
index 06ab871..b1db70b 100644
--- a/base/watchdog.cc
+++ b/base/watchdog.cc
@@ -7,6 +7,9 @@
#include "base/platform_thread.h"
#include "base/string_util.h"
+using base::TimeDelta;
+using base::TimeTicks;
+
//------------------------------------------------------------------------------
// Public API methods.
@@ -145,4 +148,3 @@ Lock Watchdog::static_lock_; // Lock for access of static data...
TimeTicks Watchdog::last_debugged_alarm_time_ = TimeTicks();
// static
TimeDelta Watchdog::last_debugged_alarm_delay_;
-
diff --git a/base/watchdog.h b/base/watchdog.h
index 0b77749..c7e967f 100644
--- a/base/watchdog.h
+++ b/base/watchdog.h
@@ -28,15 +28,15 @@ class Watchdog {
public:
// TODO(JAR)change default arg to required arg after all users have migrated.
// Constructor specifies how long the Watchdog will wait before alarming.
- Watchdog(const TimeDelta& duration,
+ Watchdog(const base::TimeDelta& duration,
const std::wstring& thread_watched_name,
bool enabled = true);
virtual ~Watchdog();
// Start timing, and alarm when time expires (unless we're disarm()ed.)
void Arm(); // Arm starting now.
- void ArmSomeTimeDeltaAgo(const TimeDelta& time_delta);
- void ArmAtStartTime(const TimeTicks start_time);
+ void ArmSomeTimeDeltaAgo(const base::TimeDelta& time_delta);
+ void ArmAtStartTime(const base::TimeTicks start_time);
// Reset time, and do not set off the alarm.
void Disarm();
@@ -60,12 +60,12 @@ class Watchdog {
Lock lock_; // Mutex for state_.
ConditionVariable condition_variable_;
State state_;
- const TimeDelta duration_; // How long after start_time_ do we alarm?
+ const base::TimeDelta duration_; // How long after start_time_ do we alarm?
const std::wstring thread_watched_name_;
HANDLE handle_; // Handle for watchdog thread.
DWORD thread_id_; // Also for watchdog thread.
- TimeTicks start_time_; // Start of epoch, and alarm after duration_.
+ base::TimeTicks start_time_; // Start of epoch, and alarm after duration_.
// When the debugger breaks (when we alarm), all the other alarms that are
// armed will expire (also alarm). To diminish this effect, we track any
@@ -75,9 +75,9 @@ class Watchdog {
// on alarms from callers that specify old times.
static Lock static_lock_; // Lock for access of static data...
// When did we last alarm and get stuck (for a while) in a debugger?
- static TimeTicks last_debugged_alarm_time_;
+ static base::TimeTicks last_debugged_alarm_time_;
// How long did we sit on a break in the debugger?
- static TimeDelta last_debugged_alarm_delay_;
+ static base::TimeDelta last_debugged_alarm_delay_;
DISALLOW_EVIL_CONSTRUCTORS(Watchdog);
diff --git a/base/watchdog_unittest.cc b/base/watchdog_unittest.cc
index c74b941..c4a664f 100644
--- a/base/watchdog_unittest.cc
+++ b/base/watchdog_unittest.cc
@@ -10,6 +10,8 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::TimeDelta;
+
namespace {
//------------------------------------------------------------------------------