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
Esse commit está contido em:
jar@chromium.org
2009-03-19 22:24:50 +00:00
commit c388d7542b
7 arquivos alterados com 12 adições e 11 exclusões
+1 -1
Ver Arquivo
@@ -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);
};
+2 -2
Ver Arquivo
@@ -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);
};
+3 -3
Ver Arquivo
@@ -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;
}
+1 -1
Ver Arquivo
@@ -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) {
+1 -1
Ver Arquivo
@@ -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() {
+3 -3
Ver Arquivo
@@ -219,7 +219,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
title = L"Untitled";
process.titles.push_back(title);
// We need to check the pending entry as well as the pending entry to
// We need to check the pending entry as well as the display_url to
// see if it's an about:memory URL (we don't want to count these in the
// total memory usage of the browser).
//
@@ -230,8 +230,8 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// entry.
//
// Either the pending or last committed entries can be NULL.
const NavigationEntry* pending_entry = NULL;
//contents->controller()->GetPendingEntry();
const NavigationEntry* pending_entry =
contents->controller()->GetPendingEntry();
const NavigationEntry* last_committed_entry =
contents->controller()->GetLastCommittedEntry();
if ((last_committed_entry &&
+1
Ver Arquivo
@@ -78,6 +78,7 @@ class DnsHostInfo {
queue_duration_(kNullDuration),
benefits_remaining_(),
sequence_number_(0),
motivation_(NO_PREFETCH_MOTIVATION),
was_linked_(false) {
}