diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:24:50 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:24:50 +0000 |
commit | 6df4074a8f9ab6039c7cb8807b61b52599d14040 (patch) | |
tree | 12cfef7094b77c34f5d0590e5e8546b6be5fcc93 /base | |
parent | c1f844dd22d6d2ca74e2d576070f66928737d5cd (diff) | |
download | chromium_src-6df4074a8f9ab6039c7cb8807b61b52599d14040.zip chromium_src-6df4074a8f9ab6039c7cb8807b61b52599d14040.tar.gz chromium_src-6df4074a8f9ab6039c7cb8807b61b52599d14040.tar.bz2 |
Fix a bunch of tiny near-bugs and bugs that static analysis identified
r=mbelshe,brettw
Review URL: http://codereview.chromium.org/50014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/histogram.cc | 2 | ||||
-rw-r--r-- | base/histogram.h | 4 | ||||
-rw-r--r-- | base/stats_table.cc | 6 | ||||
-rw-r--r-- | base/time_win_unittest.cc | 2 | ||||
-rw-r--r-- | base/tracked_objects.cc | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/base/histogram.cc b/base/histogram.cc index bdf7f9a..9184926e 100644 --- a/base/histogram.cc +++ b/base/histogram.cc @@ -640,7 +640,7 @@ void ThreadSafeHistogram::Accumulate(Sample value, Count count, size_t index) { Histogram::Accumulate(value, count, index); } -void ThreadSafeHistogram::SnapshotSample(SampleSet* sample) { +void ThreadSafeHistogram::SnapshotSample(SampleSet* sample) const { AutoLock lock(lock_); Histogram::SnapshotSample(sample); }; diff --git a/base/histogram.h b/base/histogram.h index 7ec556f..7c4b3b8 100644 --- a/base/histogram.h +++ b/base/histogram.h @@ -475,10 +475,10 @@ class ThreadSafeHistogram : public Histogram { // Provide locked versions to get precise counts. virtual void Accumulate(Sample value, Count count, size_t index); - virtual void SnapshotSample(SampleSet* sample); + virtual void SnapshotSample(SampleSet* sample) const; private: - Lock lock_; + mutable Lock lock_; DISALLOW_COPY_AND_ASSIGN(ThreadSafeHistogram); }; diff --git a/base/stats_table.cc b/base/stats_table.cc index d2b6a9e..31f85d5 100644 --- a/base/stats_table.cc +++ b/base/stats_table.cc @@ -502,9 +502,9 @@ int StatsTable::GetRowValue(int index, int pid) const { int rv = 0; int* row = impl_->row(index); - for (int index = 0; index < impl_->max_threads(); index++) { - if (pid == 0 || *impl_->thread_pid(index) == pid) - rv += row[index]; + for (int slot_id = 0; slot_id < impl_->max_threads(); slot_id++) { + if (pid == 0 || *impl_->thread_pid(slot_id) == pid) + rv += row[slot_id]; } return rv; } diff --git a/base/time_win_unittest.cc b/base/time_win_unittest.cc index 1e76a39..9dd8a23 100644 --- a/base/time_win_unittest.cc +++ b/base/time_win_unittest.cc @@ -126,7 +126,7 @@ TEST(TimeTicks, SubMillisecondTimers) { last_time = now; } EXPECT_TRUE(saw_submillisecond_timer); - printf("Min timer is: %dus\n", min_timer); + printf("Min timer is: %ldus\n", static_cast<long>(min_timer)); } TEST(TimeTicks, TimeGetTimeCaps) { diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index 3d907b2..f95f9b8 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -81,7 +81,7 @@ Lock ThreadData::list_lock_; // static ThreadData::Status ThreadData::status_ = ThreadData::UNINITIALIZED; -ThreadData::ThreadData() : message_loop_(MessageLoop::current()) {} +ThreadData::ThreadData() : next_(NULL), message_loop_(MessageLoop::current()) {} // static ThreadData* ThreadData::current() { |