diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 22:54:58 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 22:54:58 +0000 |
commit | d4799a3bf70ecc62ab702150cae1d1e925b14938 (patch) | |
tree | fae21bc09ddaa68dfc709e0d6abc55a43fe99333 /net | |
parent | 7176ef1c7ada2da66a47ed38987c92a06f3bfb4a (diff) | |
download | chromium_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 'net')
-rw-r--r-- | net/base/host_resolver.cc | 6 | ||||
-rw-r--r-- | net/base/host_resolver.h | 4 | ||||
-rw-r--r-- | net/base/x509_cert_types.h | 3 | ||||
-rw-r--r-- | net/disk_cache/block_files.cc | 4 | ||||
-rw-r--r-- | net/disk_cache/block_files.h | 3 | ||||
-rw-r--r-- | net/disk_cache/in_flight_io.cc | 14 | ||||
-rw-r--r-- | net/disk_cache/in_flight_io.h | 11 | ||||
-rw-r--r-- | net/disk_cache/rankings.cc | 14 | ||||
-rw-r--r-- | net/disk_cache/rankings.h | 14 | ||||
-rw-r--r-- | net/disk_cache/trace.cc | 8 | ||||
-rw-r--r-- | net/disk_cache/trace.h | 9 | ||||
-rw-r--r-- | net/http/http_util.cc | 6 | ||||
-rw-r--r-- | net/http/http_util.h | 2 | ||||
-rw-r--r-- | net/spdy/spdy_settings_storage.cc | 3 | ||||
-rw-r--r-- | net/spdy/spdy_settings_storage.h | 1 |
15 files changed, 72 insertions, 30 deletions
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc index abef6f5..fbd63bd 100644 --- a/net/base/host_resolver.cc +++ b/net/base/host_resolver.cc @@ -19,6 +19,12 @@ HostResolver::RequestInfo::RequestInfo(const HostPortPair& host_port_pair) priority_(MEDIUM) { } +HostResolver::HostResolver() { +} + +HostResolver::~HostResolver() { +} + SingleRequestHostResolver::SingleRequestHostResolver(HostResolver* resolver) : resolver_(resolver), cur_request_(NULL), diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 58ea8bd..1c0982d 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -176,12 +176,12 @@ class HostResolver : public base::RefCounted<HostResolver> { protected: friend class base::RefCounted<HostResolver>; - HostResolver() { } + HostResolver(); // If any completion callbacks are pending when the resolver is destroyed, // the host resolutions are cancelled, and the completion callbacks will not // be called. - virtual ~HostResolver() {} + virtual ~HostResolver(); private: DISALLOW_COPY_AND_ASSIGN(HostResolver); diff --git a/net/base/x509_cert_types.h b/net/base/x509_cert_types.h index 43d05dd..7723c22 100644 --- a/net/base/x509_cert_types.h +++ b/net/base/x509_cert_types.h @@ -42,8 +42,7 @@ struct SHA1Fingerprint { unsigned char data[20]; }; -class SHA1FingerprintLessThan - : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { +class SHA1FingerprintLessThan { public: bool operator() (const SHA1Fingerprint& lhs, const SHA1Fingerprint& rhs) const { diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index e0021a8..7936b8f 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -184,6 +184,10 @@ bool NeedToGrowBlockFile(const disk_cache::BlockFileHeader* header, namespace disk_cache { +BlockFiles::BlockFiles(const FilePath& path) + : init_(false), zero_buffer_(NULL), path_(path) { +} + BlockFiles::~BlockFiles() { if (zero_buffer_) delete[] zero_buffer_; diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h index 2e41750..5427a58 100644 --- a/net/disk_cache/block_files.h +++ b/net/disk_cache/block_files.h @@ -23,8 +23,7 @@ namespace disk_cache { // This class handles the set of block-files open by the disk cache. class BlockFiles { public: - explicit BlockFiles(const FilePath& path) - : init_(false), zero_buffer_(NULL), path_(path) {} + explicit BlockFiles(const FilePath& path); ~BlockFiles(); // Performs the object initialization. create_files indicates if the backing diff --git a/net/disk_cache/in_flight_io.cc b/net/disk_cache/in_flight_io.cc index 6112a9c..5c859af 100644 --- a/net/disk_cache/in_flight_io.cc +++ b/net/disk_cache/in_flight_io.cc @@ -8,6 +8,10 @@ namespace disk_cache { +BackgroundIO::BackgroundIO(InFlightIO* controller) + : controller_(controller), result_(-1), io_completed_(true, false) { +} + // Runs on the primary thread. void BackgroundIO::OnIOSignalled() { if (controller_) @@ -19,6 +23,8 @@ void BackgroundIO::Cancel() { controller_ = NULL; } +BackgroundIO::~BackgroundIO() {} + // Runs on the background thread. void BackgroundIO::NotifyController() { controller_->OnIOComplete(this); @@ -26,6 +32,14 @@ void BackgroundIO::NotifyController() { // --------------------------------------------------------------------------- +InFlightIO::InFlightIO() + : callback_thread_(base::MessageLoopProxy::CreateForCurrentThread()), + running_(false), single_thread_(false) { +} + +InFlightIO::~InFlightIO() { +} + void InFlightIO::WaitForPendingIO() { while (!io_list_.empty()) { // Block the current thread until all pending IO completes. diff --git a/net/disk_cache/in_flight_io.h b/net/disk_cache/in_flight_io.h index 70a3d8c..6c5f8ab 100644 --- a/net/disk_cache/in_flight_io.h +++ b/net/disk_cache/in_flight_io.h @@ -24,8 +24,7 @@ class BackgroundIO : public base::RefCountedThreadSafe<BackgroundIO> { // is keeping track of all operations. When done, we notify the controller // (we do NOT invoke the callback), in the worker thead that completed the // operation. - explicit BackgroundIO(InFlightIO* controller) - : controller_(controller), result_(-1), io_completed_(true, false) {} + explicit BackgroundIO(InFlightIO* controller); // This method signals the controller that this operation is finished, in the // original thread. In practice, this is a RunableMethod that allows @@ -47,7 +46,7 @@ class BackgroundIO : public base::RefCountedThreadSafe<BackgroundIO> { } protected: - virtual ~BackgroundIO() {} + virtual ~BackgroundIO(); InFlightIO* controller_; // The controller that tracks all operations. int result_; // Final operation result. @@ -89,10 +88,8 @@ class BackgroundIO : public base::RefCountedThreadSafe<BackgroundIO> { // of just waiting for step 7. class InFlightIO { public: - InFlightIO() - : callback_thread_(base::MessageLoopProxy::CreateForCurrentThread()), - running_(false), single_thread_(false) {} - virtual ~InFlightIO() {} + InFlightIO(); + virtual ~InFlightIO(); // Blocks the current thread until all IO operations tracked by this object // complete. diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc index 34c002b..e7c6736 100644 --- a/net/disk_cache/rankings.cc +++ b/net/disk_cache/rankings.cc @@ -176,6 +176,20 @@ void GenerateCrash(CrashLocation location) { namespace disk_cache { +Rankings::Iterator::Iterator(Rankings* rankings) { + memset(this, 0, sizeof(Iterator)); + my_rankings = rankings; +} + +Rankings::Iterator::~Iterator() { + for (int i = 0; i < 3; i++) + ScopedRankingsBlock(my_rankings, nodes[i]); +} + +Rankings::Rankings() : init_(false) {} + +Rankings::~Rankings() {} + bool Rankings::Init(BackendImpl* backend, bool count_lists) { DCHECK(!init_); if (init_) diff --git a/net/disk_cache/rankings.h b/net/disk_cache/rankings.h index 8347b4c..1914cf6 100644 --- a/net/disk_cache/rankings.h +++ b/net/disk_cache/rankings.h @@ -96,18 +96,12 @@ class Rankings { List list; // Which entry was returned to the user. CacheRankingsBlock* nodes[3]; // Nodes on the first three lists. Rankings* my_rankings; - explicit Iterator(Rankings* rankings) { - memset(this, 0, sizeof(Iterator)); - my_rankings = rankings; - } - ~Iterator() { - for (int i = 0; i < 3; i++) - ScopedRankingsBlock(my_rankings, nodes[i]); - } + explicit Iterator(Rankings* rankings); + ~Iterator(); }; - Rankings() : init_(false) {} - ~Rankings() {} + Rankings(); + ~Rankings(); bool Init(BackendImpl* backend, bool count_lists); diff --git a/net/disk_cache/trace.cc b/net/disk_cache/trace.cc index 7a61e20..9578339 100644 --- a/net/disk_cache/trace.cc +++ b/net/disk_cache/trace.cc @@ -57,6 +57,14 @@ TraceObject* TraceObject::GetTraceObject() { return s_trace_object; } +TraceObject::TraceObject() { + InitTrace(); +} + +TraceObject::~TraceObject() { + DestroyTrace(); +} + #if ENABLE_TRACING static TraceBuffer* s_trace_buffer = NULL; diff --git a/net/disk_cache/trace.h b/net/disk_cache/trace.h index 25d9b33..a5aa651 100644 --- a/net/disk_cache/trace.h +++ b/net/disk_cache/trace.h @@ -27,13 +27,8 @@ class TraceObject : public base::RefCounted<TraceObject> { static TraceObject* GetTraceObject(); private: - TraceObject() { - InitTrace(); - } - - ~TraceObject() { - DestroyTrace(); - } + TraceObject(); + ~TraceObject(); DISALLOW_COPY_AND_ASSIGN(TraceObject); }; diff --git a/net/http/http_util.cc b/net/http/http_util.cc index a559c06..1098a06 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -631,6 +631,9 @@ HttpUtil::HeadersIterator::HeadersIterator(string::const_iterator headers_begin, : lines_(headers_begin, headers_end, line_delimiter) { } +HttpUtil::HeadersIterator::~HeadersIterator() { +} + bool HttpUtil::HeadersIterator::GetNext() { while (lines_.GetNext()) { name_begin_ = lines_.token_begin(); @@ -683,6 +686,9 @@ HttpUtil::ValuesIterator::ValuesIterator( values_.set_quote_chars("\'\""); } +HttpUtil::ValuesIterator::~ValuesIterator() { +} + bool HttpUtil::ValuesIterator::GetNext() { while (values_.GetNext()) { value_begin_ = values_.token_begin(); diff --git a/net/http/http_util.h b/net/http/http_util.h index 6daf173..776b876 100644 --- a/net/http/http_util.h +++ b/net/http/http_util.h @@ -167,6 +167,7 @@ class HttpUtil { HeadersIterator(std::string::const_iterator headers_begin, std::string::const_iterator headers_end, const std::string& line_delimiter); + ~HeadersIterator(); // Advances the iterator to the next header, if any. Returns true if there // is a next header. Use name* and values* methods to access the resultant @@ -229,6 +230,7 @@ class HttpUtil { ValuesIterator(std::string::const_iterator values_begin, std::string::const_iterator values_end, char delimiter); + ~ValuesIterator(); // Advances the iterator to the next value, if any. Returns true if there // is a next value. Use value* methods to access the resultant value. diff --git a/net/spdy/spdy_settings_storage.cc b/net/spdy/spdy_settings_storage.cc index 32069b7..dc9bdcd 100644 --- a/net/spdy/spdy_settings_storage.cc +++ b/net/spdy/spdy_settings_storage.cc @@ -11,6 +11,9 @@ namespace net { SpdySettingsStorage::SpdySettingsStorage() { } +SpdySettingsStorage::~SpdySettingsStorage() { +} + const spdy::SpdySettings& SpdySettingsStorage::Get( const HostPortPair& host_port_pair) const { SettingsMap::const_iterator it = settings_map_.find(host_port_pair); diff --git a/net/spdy/spdy_settings_storage.h b/net/spdy/spdy_settings_storage.h index 09d829e..999f016 100644 --- a/net/spdy/spdy_settings_storage.h +++ b/net/spdy/spdy_settings_storage.h @@ -18,6 +18,7 @@ namespace net { class SpdySettingsStorage { public: SpdySettingsStorage(); + ~SpdySettingsStorage(); // Get a copy of the SpdySettings stored for a host. // If no settings are stored, returns an empty set of settings. |