summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-07 00:49:34 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-07 00:49:34 +0000
commit5138d5f0b0c79ec5bae32cc506a0e21a9ad9c986 (patch)
tree3da08f18243cc12d1bb5199c841ae3942e84c65e /net
parent92406269a4f6363ca5e0f50d7b175f7d647f8e67 (diff)
downloadchromium_src-5138d5f0b0c79ec5bae32cc506a0e21a9ad9c986.zip
chromium_src-5138d5f0b0c79ec5bae32cc506a0e21a9ad9c986.tar.gz
chromium_src-5138d5f0b0c79ec5bae32cc506a0e21a9ad9c986.tar.bz2
disk cache: Add NET_API for net.dll
BUG=76997 TEST=NONE Review URL: http://codereview.chromium.org/6933045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/addr.h3
-rw-r--r--net/disk_cache/backend_impl.h6
-rw-r--r--net/disk_cache/bitmap.h5
-rw-r--r--net/disk_cache/block_files.h3
-rw-r--r--net/disk_cache/cache_util.h9
-rw-r--r--net/disk_cache/disk_cache.h16
-rw-r--r--net/disk_cache/disk_format.h7
-rw-r--r--net/disk_cache/entry_impl.h2
-rw-r--r--net/disk_cache/file.h3
-rw-r--r--net/disk_cache/file_lock.h5
-rw-r--r--net/disk_cache/hash.h5
-rw-r--r--net/disk_cache/mapped_file.h5
-rw-r--r--net/disk_cache/mem_backend_impl.h4
-rw-r--r--net/disk_cache/rankings.cc30
-rw-r--r--net/disk_cache/trace.h3
15 files changed, 60 insertions, 46 deletions
diff --git a/net/disk_cache/addr.h b/net/disk_cache/addr.h
index d754ec5..cd4dc63 100644
--- a/net/disk_cache/addr.h
+++ b/net/disk_cache/addr.h
@@ -9,6 +9,7 @@
#define NET_DISK_CACHE_ADDR_H_
#pragma once
+#include "net/base/net_api.h"
#include "net/disk_cache/disk_format.h"
namespace disk_cache {
@@ -47,7 +48,7 @@ const int kFirstAdditionalBlockFile = 4;
// 0000 0011 0000 0000 0000 0000 0000 0000 : number of contiguous blocks 1-4
// 0000 0000 1111 1111 0000 0000 0000 0000 : file selector 0 - 255
// 0000 0000 0000 0000 1111 1111 1111 1111 : block# 0 - 65,535 (2^16)
-class Addr {
+class NET_TEST Addr {
public:
Addr() : value_(0) {}
explicit Addr(CacheAddr address) : value_(address) {}
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 92d207b..e66fb4b 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -39,7 +39,7 @@ enum BackendFlags {
// This class implements the Backend interface. An object of this
// class handles the operations of the cache for a particular profile.
-class BackendImpl : public Backend {
+class NET_TEST BackendImpl : public Backend {
friend class Eviction;
public:
BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread,
@@ -381,7 +381,7 @@ class BackendImpl : public Backend {
};
// Returns the prefered max cache size given the available disk space.
-int PreferedCacheSize(int64 available);
+NET_TEST int PreferedCacheSize(int64 available);
} // namespace disk_cache
diff --git a/net/disk_cache/bitmap.h b/net/disk_cache/bitmap.h
index 8b3324c..23e392f 100644
--- a/net/disk_cache/bitmap.h
+++ b/net/disk_cache/bitmap.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -7,11 +7,12 @@
#pragma once
#include "base/basictypes.h"
+#include "net/base/net_api.h"
namespace disk_cache {
// This class provides support for simple maps of bits.
-class Bitmap {
+class NET_TEST Bitmap {
public:
Bitmap() : map_(NULL), num_bits_(0), array_size_(0), alloc_(false) {}
diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h
index 5f1fa3c..3e59cbc 100644
--- a/net/disk_cache/block_files.h
+++ b/net/disk_cache/block_files.h
@@ -13,6 +13,7 @@
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "net/base/net_api.h"
#include "net/disk_cache/addr.h"
#include "net/disk_cache/mapped_file.h"
@@ -23,7 +24,7 @@ class ThreadChecker;
namespace disk_cache {
// This class handles the set of block-files open by the disk cache.
-class BlockFiles {
+class NET_TEST BlockFiles {
public:
explicit BlockFiles(const FilePath& path);
~BlockFiles();
diff --git a/net/disk_cache/cache_util.h b/net/disk_cache/cache_util.h
index 04b9a07..47630b9 100644
--- a/net/disk_cache/cache_util.h
+++ b/net/disk_cache/cache_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "net/base/net_api.h"
class FilePath;
@@ -18,14 +19,14 @@ namespace disk_cache {
// for the cache directory. Returns true if successful. On ChromeOS,
// this moves the cache contents, and leaves the empty cache
// directory.
-bool MoveCache(const FilePath& from_path, const FilePath& to_path);
+NET_TEST bool MoveCache(const FilePath& from_path, const FilePath& to_path);
// Deletes the cache files stored on |path|, and optionally also attempts to
// delete the folder itself.
-void DeleteCache(const FilePath& path, bool remove_folder);
+NET_TEST void DeleteCache(const FilePath& path, bool remove_folder);
// Deletes a cache file.
-bool DeleteCacheFile(const FilePath& name);
+NET_TEST bool DeleteCacheFile(const FilePath& name);
} // namespace disk_cache
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index 18dd447..ff0ce7a 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/time.h"
+#include "net/base/net_api.h"
#include "net/base/cache_type.h"
#include "net/base/completion_callback.h"
@@ -49,13 +50,14 @@ typedef net::CompletionCallback CompletionCallback;
// be invoked when a backend is available or a fatal error condition is reached.
// The pointer to receive the |backend| must remain valid until the operation
// completes (the callback is notified).
-int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
- bool force, base::MessageLoopProxy* thread,
- net::NetLog* net_log, Backend** backend,
- CompletionCallback* callback);
+NET_API int CreateCacheBackend(net::CacheType type, const FilePath& path,
+ int max_bytes, bool force,
+ base::MessageLoopProxy* thread,
+ net::NetLog* net_log, Backend** backend,
+ CompletionCallback* callback);
// The root interface for a disk cache instance.
-class Backend {
+class NET_API Backend {
public:
// If the backend is destroyed when there are operations in progress (any
// callback that has not been invoked yet), this method cancels said
@@ -138,7 +140,7 @@ class Backend {
};
// This interface represents an entry in the disk cache.
-class Entry {
+class NET_TEST Entry {
public:
// Marks this cache entry for deletion.
virtual void Doom() = 0;
diff --git a/net/disk_cache/disk_format.h b/net/disk_cache/disk_format.h
index ffe36ae..661e4c8 100644
--- a/net/disk_cache/disk_format.h
+++ b/net/disk_cache/disk_format.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -57,6 +57,7 @@
#pragma once
#include "base/basictypes.h"
+#include "net/base/net_api.h"
namespace disk_cache {
@@ -79,7 +80,7 @@ struct LruData {
};
// Header for the master index file.
-struct IndexHeader {
+struct NET_TEST IndexHeader {
IndexHeader();
uint32 magic;
@@ -173,7 +174,7 @@ typedef uint32 AllocBitmap[kMaxBlocks / 32];
// where did we find the last entry of that type (to avoid searching the bitmap
// from the beginning every time).
// This Structure is the header of a block-file:
-struct BlockFileHeader {
+struct NET_TEST BlockFileHeader {
BlockFileHeader();
uint32 magic;
diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h
index fab676a..59901a8 100644
--- a/net/disk_cache/entry_impl.h
+++ b/net/disk_cache/entry_impl.h
@@ -19,7 +19,7 @@ class SparseControl;
// This class implements the Entry interface. An object of this
// class represents a single entry on the cache.
-class EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
+class NET_TEST EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
friend class base::RefCounted<EntryImpl>;
friend class SparseControl;
public:
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index 86e6920..fcc3ce8 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
+#include "net/base/net_api.h"
class FilePath;
@@ -26,7 +27,7 @@ class FileIOCallback {
};
// Simple wrapper around a file that allows asynchronous operations.
-class File : public base::RefCounted<File> {
+class NET_TEST File : public base::RefCounted<File> {
friend class base::RefCounted<File>;
public:
File();
diff --git a/net/disk_cache/file_lock.h b/net/disk_cache/file_lock.h
index 2c560ef..48f872a 100644
--- a/net/disk_cache/file_lock.h
+++ b/net/disk_cache/file_lock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,6 +8,7 @@
#define NET_DISK_CACHE_FILE_LOCK_H__
#pragma once
+#include "net/base/net_api.h"
#include "net/disk_cache/disk_format.h"
namespace disk_cache {
@@ -27,7 +28,7 @@ namespace disk_cache {
// because otherwise the desired effect of the "lock" will not be achieved. If
// the operations are inlined / optimized, the "locked" operations can happen
// outside the lock.
-class FileLock {
+class NET_TEST FileLock {
public:
explicit FileLock(BlockFileHeader* header);
virtual ~FileLock() {
diff --git a/net/disk_cache/hash.h b/net/disk_cache/hash.h
index 01e0058..4517653 100644
--- a/net/disk_cache/hash.h
+++ b/net/disk_cache/hash.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,12 +9,13 @@
#include <string>
#include "base/basictypes.h"
+#include "net/base/net_api.h"
namespace disk_cache {
// From http://www.azillionmonkeys.com/qed/hash.html
// This is the hash used on WebCore/platform/stringhash
-uint32 SuperFastHash(const char * data, int len);
+NET_TEST uint32 SuperFastHash(const char * data, int len);
inline uint32 Hash(const char* key, size_t length) {
return SuperFastHash(key, static_cast<int>(length));
diff --git a/net/disk_cache/mapped_file.h b/net/disk_cache/mapped_file.h
index c39f3f9..24208cb 100644
--- a/net/disk_cache/mapped_file.h
+++ b/net/disk_cache/mapped_file.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,6 +8,7 @@
#define NET_DISK_CACHE_MAPPED_FILE_H_
#pragma once
+#include "net/base/net_api.h"
#include "net/disk_cache/disk_format.h"
#include "net/disk_cache/file.h"
#include "net/disk_cache/file_block.h"
@@ -20,7 +21,7 @@ namespace disk_cache {
// idea is that the header and bitmap will be memory mapped all the time, and
// the actual data for the blocks will be access asynchronously (most of the
// time).
-class MappedFile : public File {
+class NET_TEST MappedFile : public File {
public:
MappedFile() : File(true), init_(false) {}
diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h
index 01f68d3..dae4289 100644
--- a/net/disk_cache/mem_backend_impl.h
+++ b/net/disk_cache/mem_backend_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -23,7 +23,7 @@ class MemEntryImpl;
// This class implements the Backend interface. An object of this class handles
// the operations of the cache without writing to disk.
-class MemBackendImpl : public Backend {
+class NET_TEST MemBackendImpl : public Backend {
public:
explicit MemBackendImpl(net::NetLog* net_log);
~MemBackendImpl();
diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc
index 12ccdd6..b32984c 100644
--- a/net/disk_cache/rankings.cc
+++ b/net/disk_cache/rankings.cc
@@ -13,8 +13,10 @@
using base::Time;
using base::TimeTicks;
+namespace disk_cache {
// This is used by crash_cache.exe to generate unit test files.
-disk_cache::RankCrashes g_rankings_crash = disk_cache::NO_CRASH;
+NET_TEST RankCrashes g_rankings_crash = NO_CRASH;
+}
namespace {
@@ -82,11 +84,11 @@ void TerminateSelf() {
// This used by crash_cache.exe to generate unit-test files.
void GenerateCrash(CrashLocation location) {
#ifndef NDEBUG
- if (disk_cache::NO_CRASH == g_rankings_crash)
+ if (disk_cache::NO_CRASH == disk_cache::g_rankings_crash)
return;
switch (location) {
case ON_INSERT_1:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::INSERT_ONE_1:
case disk_cache::INSERT_LOAD_1:
TerminateSelf();
@@ -95,11 +97,11 @@ void GenerateCrash(CrashLocation location) {
}
break;
case ON_INSERT_2:
- if (disk_cache::INSERT_EMPTY_1 == g_rankings_crash)
+ if (disk_cache::INSERT_EMPTY_1 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_INSERT_3:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::INSERT_EMPTY_2:
case disk_cache::INSERT_ONE_2:
case disk_cache::INSERT_LOAD_2:
@@ -109,7 +111,7 @@ void GenerateCrash(CrashLocation location) {
}
break;
case ON_INSERT_4:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::INSERT_EMPTY_3:
case disk_cache::INSERT_ONE_3:
TerminateSelf();
@@ -118,7 +120,7 @@ void GenerateCrash(CrashLocation location) {
}
break;
case ON_REMOVE_1:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::REMOVE_ONE_1:
case disk_cache::REMOVE_HEAD_1:
case disk_cache::REMOVE_TAIL_1:
@@ -129,27 +131,27 @@ void GenerateCrash(CrashLocation location) {
}
break;
case ON_REMOVE_2:
- if (disk_cache::REMOVE_ONE_2 == g_rankings_crash)
+ if (disk_cache::REMOVE_ONE_2 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_REMOVE_3:
- if (disk_cache::REMOVE_ONE_3 == g_rankings_crash)
+ if (disk_cache::REMOVE_ONE_3 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_REMOVE_4:
- if (disk_cache::REMOVE_HEAD_2 == g_rankings_crash)
+ if (disk_cache::REMOVE_HEAD_2 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_REMOVE_5:
- if (disk_cache::REMOVE_TAIL_2 == g_rankings_crash)
+ if (disk_cache::REMOVE_TAIL_2 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_REMOVE_6:
- if (disk_cache::REMOVE_TAIL_3 == g_rankings_crash)
+ if (disk_cache::REMOVE_TAIL_3 == disk_cache::g_rankings_crash)
TerminateSelf();
break;
case ON_REMOVE_7:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::REMOVE_ONE_4:
case disk_cache::REMOVE_LOAD_2:
case disk_cache::REMOVE_HEAD_3:
@@ -159,7 +161,7 @@ void GenerateCrash(CrashLocation location) {
}
break;
case ON_REMOVE_8:
- switch (g_rankings_crash) {
+ switch (disk_cache::g_rankings_crash) {
case disk_cache::REMOVE_HEAD_4:
case disk_cache::REMOVE_LOAD_3:
TerminateSelf();
diff --git a/net/disk_cache/trace.h b/net/disk_cache/trace.h
index 01369fb..f1996dd 100644
--- a/net/disk_cache/trace.h
+++ b/net/disk_cache/trace.h
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include "net/base/net_api.h"
namespace disk_cache {
@@ -33,7 +34,7 @@ class TraceObject : public base::RefCounted<TraceObject> {
};
// Traces to the internal buffer.
-void Trace(const char* format, ...);
+NET_TEST void Trace(const char* format, ...);
} // namespace disk_cache