summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:54:58 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:54:58 +0000
commitd4799a3bf70ecc62ab702150cae1d1e925b14938 (patch)
treefae21bc09ddaa68dfc709e0d6abc55a43fe99333 /base
parent7176ef1c7ada2da66a47ed38987c92a06f3bfb4a (diff)
downloadchromium_src-d4799a3bf70ecc62ab702150cae1d1e925b14938.zip
chromium_src-d4799a3bf70ecc62ab702150cae1d1e925b14938.tar.gz
chromium_src-d4799a3bf70ecc62ab702150cae1d1e925b14938.tar.bz2
FBTF: Moves code to the headers.
One of the big things is starting to move/declare ctors/dtors that derive from RefCounted<> to/in the implementation file. (Saves 4 megabytes from libglue.a alone. 1 meg off libbrowser.a. Hundred of kilobyte savings in a large number of .a files; only libmedia.a grew and it's only 100k.) BUG=none TEST=compiles Review URL: http://codereview.chromium.org/3452030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gypi2
-rw-r--r--base/histogram.cc6
-rw-r--r--base/histogram.h4
-rw-r--r--base/message_loop_proxy.cc19
-rw-r--r--base/message_loop_proxy.h7
-rw-r--r--base/message_pump.cc15
-rw-r--r--base/message_pump.h3
-rw-r--r--base/ref_counted_memory.cc6
-rw-r--r--base/ref_counted_memory.h4
-rw-r--r--base/tracked_objects.cc12
-rw-r--r--base/tracked_objects.h5
-rw-r--r--base/waitable_event.h6
-rw-r--r--base/waitable_event_posix.cc9
13 files changed, 86 insertions, 12 deletions
diff --git a/base/base.gypi b/base/base.gypi
index 3c5e1a0..7c66586 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -128,9 +128,11 @@
'memory_debug.h',
'message_loop.cc',
'message_loop.h',
+ 'message_loop_proxy.cc',
'message_loop_proxy.h',
'message_loop_proxy_impl.cc',
'message_loop_proxy_impl.h',
+ 'message_pump.cc',
'message_pump.h',
'message_pump_default.cc',
'message_pump_default.h',
diff --git a/base/histogram.cc b/base/histogram.cc
index add7954..e045d81 100644
--- a/base/histogram.cc
+++ b/base/histogram.cc
@@ -503,6 +503,9 @@ Histogram::SampleSet::SampleSet()
square_sum_(0) {
}
+Histogram::SampleSet::~SampleSet() {
+}
+
void Histogram::SampleSet::Resize(const Histogram& histogram) {
counts_.resize(histogram.bucket_count(), 0);
}
@@ -625,6 +628,9 @@ scoped_refptr<Histogram> LinearHistogram::FactoryTimeGet(
bucket_count, flags);
}
+LinearHistogram::~LinearHistogram() {
+}
+
LinearHistogram::LinearHistogram(const std::string& name, Sample minimum,
Sample maximum, size_t bucket_count)
: Histogram(name, minimum >= 1 ? minimum : 1, maximum, bucket_count) {
diff --git a/base/histogram.h b/base/histogram.h
index adf673c..0287d37 100644
--- a/base/histogram.h
+++ b/base/histogram.h
@@ -272,6 +272,8 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> {
class SampleSet {
public:
explicit SampleSet();
+ ~SampleSet();
+
// Adjust size of counts_ for use with given histogram.
void Resize(const Histogram& histogram);
void CheckSize(const Histogram& histogram) const;
@@ -490,6 +492,8 @@ class LinearHistogram : public Histogram {
base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count,
Flags flags);
+ virtual ~LinearHistogram();
+
protected:
LinearHistogram(const std::string& name, Sample minimum,
Sample maximum, size_t bucket_count);
diff --git a/base/message_loop_proxy.cc b/base/message_loop_proxy.cc
new file mode 100644
index 0000000..bc7088d
--- /dev/null
+++ b/base/message_loop_proxy.cc
@@ -0,0 +1,19 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/message_loop_proxy.h"
+
+namespace base {
+
+MessageLoopProxy::MessageLoopProxy() {
+}
+
+MessageLoopProxy::~MessageLoopProxy() {
+}
+
+void MessageLoopProxy::OnDestruct() {
+ delete this;
+}
+
+} // namespace base
diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h
index df50485..20e9e10 100644
--- a/base/message_loop_proxy.h
+++ b/base/message_loop_proxy.h
@@ -57,13 +57,12 @@ class MessageLoopProxy
protected:
friend struct MessageLoopProxyTraits;
- virtual ~MessageLoopProxy() { }
+ MessageLoopProxy();
+ virtual ~MessageLoopProxy();
// Called when the proxy is about to be deleted. Subclasses can override this
// to provide deletion on specific threads.
- virtual void OnDestruct() {
- delete this;
- }
+ virtual void OnDestruct();
};
struct MessageLoopProxyTraits {
diff --git a/base/message_pump.cc b/base/message_pump.cc
new file mode 100644
index 0000000..de7c517
--- /dev/null
+++ b/base/message_pump.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/message_pump.h"
+
+namespace base {
+
+MessagePump::MessagePump() {
+}
+
+MessagePump::~MessagePump() {
+}
+
+} // namespace base
diff --git a/base/message_pump.h b/base/message_pump.h
index 0cf1420..f8a097d 100644
--- a/base/message_pump.h
+++ b/base/message_pump.h
@@ -40,7 +40,8 @@ class MessagePump : public RefCountedThreadSafe<MessagePump> {
virtual bool DoIdleWork() = 0;
};
- virtual ~MessagePump() {}
+ MessagePump();
+ virtual ~MessagePump();
// The Run method is called to enter the message pump's run loop.
//
diff --git a/base/ref_counted_memory.cc b/base/ref_counted_memory.cc
index 6b6328c..0a4a613 100644
--- a/base/ref_counted_memory.cc
+++ b/base/ref_counted_memory.cc
@@ -4,6 +4,12 @@
#include "base/ref_counted_memory.h"
+RefCountedMemory::RefCountedMemory() {
+}
+
+RefCountedMemory::~RefCountedMemory() {
+}
+
const unsigned char* RefCountedStaticMemory::front() const {
return data_;
}
diff --git a/base/ref_counted_memory.h b/base/ref_counted_memory.h
index 418405a..08400ec 100644
--- a/base/ref_counted_memory.h
+++ b/base/ref_counted_memory.h
@@ -27,8 +27,8 @@ class RefCountedMemory : public base::RefCountedThreadSafe<RefCountedMemory> {
protected:
friend class base::RefCountedThreadSafe<RefCountedMemory>;
-
- virtual ~RefCountedMemory() {}
+ RefCountedMemory();
+ virtual ~RefCountedMemory();
};
// An implementation of RefCountedMemory, where the ref counting does not
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index a3c125b..4831e4a 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -91,6 +91,8 @@ ThreadData::Status ThreadData::status_ = ThreadData::UNINITIALIZED;
ThreadData::ThreadData() : next_(NULL), message_loop_(MessageLoop::current()) {}
+ThreadData::~ThreadData() {}
+
// static
ThreadData* ThreadData::current() {
if (!tls_index_.initialized())
@@ -584,6 +586,9 @@ DataCollector::DataCollector() {
}
}
+DataCollector::~DataCollector() {
+}
+
void DataCollector::Append(const ThreadData& thread_data) {
// Get copy of data (which is done under ThreadData's lock).
ThreadData::BirthMap birth_map;
@@ -627,6 +632,13 @@ void DataCollector::AddListOfLivingObjects() {
//------------------------------------------------------------------------------
// Aggregation
+Aggregation::Aggregation()
+ : birth_count_(0) {
+}
+
+Aggregation::~Aggregation() {
+}
+
void Aggregation::AddDeathSnapshot(const Snapshot& snapshot) {
AddBirth(snapshot.birth());
death_threads_[snapshot.death_thread()]++;
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 5392b9a..b76a295 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -293,6 +293,7 @@ class DataCollector {
// Construct with a list of how many threads should contribute. This helps us
// determine (in the async case) when we are done with all contributions.
DataCollector();
+ ~DataCollector();
// Add all stats from the indicated thread into our arrays. This function is
// mutex protected, and *could* be called from any threads (although current
@@ -333,7 +334,8 @@ class DataCollector {
class Aggregation: public DeathData {
public:
- Aggregation() : birth_count_(0) {}
+ Aggregation();
+ ~Aggregation();
void AddDeathSnapshot(const Snapshot& snapshot);
void AddBirths(const Births& births);
@@ -469,6 +471,7 @@ class ThreadData {
typedef std::map<const Births*, DeathData> DeathMap;
ThreadData();
+ ~ThreadData();
// Using Thread Local Store, find the current instance for collecting data.
// If an instance does not exist, construct one (and remember it for use on
diff --git a/base/waitable_event.h b/base/waitable_event.h
index 0a82655..081ad66 100644
--- a/base/waitable_event.h
+++ b/base/waitable_event.h
@@ -144,10 +144,8 @@ class WaitableEvent {
struct WaitableEventKernel :
public RefCountedThreadSafe<WaitableEventKernel> {
public:
- WaitableEventKernel(bool manual_reset, bool initially_signaled)
- : manual_reset_(manual_reset),
- signaled_(initially_signaled) {
- }
+ WaitableEventKernel(bool manual_reset, bool initially_signaled);
+ virtual ~WaitableEventKernel();
bool Dequeue(Waiter* waiter, void* tag);
diff --git a/base/waitable_event_posix.cc b/base/waitable_event_posix.cc
index 793f635..adc521e 100644
--- a/base/waitable_event_posix.cc
+++ b/base/waitable_event_posix.cc
@@ -335,6 +335,15 @@ size_t WaitableEvent::EnqueueMany
// -----------------------------------------------------------------------------
// Private functions...
+WaitableEvent::WaitableEventKernel::WaitableEventKernel(bool manual_reset,
+ bool initially_signaled)
+ : manual_reset_(manual_reset),
+ signaled_(initially_signaled) {
+}
+
+WaitableEvent::WaitableEventKernel::~WaitableEventKernel() {
+}
+
// -----------------------------------------------------------------------------
// Wake all waiting waiters. Called with lock held.
// -----------------------------------------------------------------------------