summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
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 /net/disk_cache
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 'net/disk_cache')
-rw-r--r--net/disk_cache/block_files.cc4
-rw-r--r--net/disk_cache/block_files.h3
-rw-r--r--net/disk_cache/in_flight_io.cc14
-rw-r--r--net/disk_cache/in_flight_io.h11
-rw-r--r--net/disk_cache/rankings.cc14
-rw-r--r--net/disk_cache/rankings.h14
-rw-r--r--net/disk_cache/trace.cc8
-rw-r--r--net/disk_cache/trace.h9
8 files changed, 51 insertions, 26 deletions
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);
};