diff options
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/addr.cc | 29 | ||||
-rw-r--r-- | net/disk_cache/addr.h | 30 | ||||
-rw-r--r-- | net/disk_cache/rankings.h | 1 | ||||
-rw-r--r-- | net/disk_cache/storage_block-inl.h | 8 |
4 files changed, 40 insertions, 28 deletions
diff --git a/net/disk_cache/addr.cc b/net/disk_cache/addr.cc new file mode 100644 index 0000000..aa84c01 --- /dev/null +++ b/net/disk_cache/addr.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2009 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 "net/disk_cache/addr.h" + +#include "base/logging.h" + +namespace disk_cache { + +int Addr::start_block() const { + DCHECK(is_block_file()); + return value_ & kStartBlockMask; +} + +int Addr::num_blocks() const { + DCHECK(is_block_file() || !value_); + return ((value_ & kNumBlocksMask) >> kNumBlocksOffset) + 1; +} + +bool Addr::SetFileNumber(int file_number) { + DCHECK(is_separate_file()); + if (file_number & ~kFileNameMask) + return false; + value_ = kInitializedMask | file_number; + return true; +} + +} // namespace disk_cache diff --git a/net/disk_cache/addr.h b/net/disk_cache/addr.h index 375b2c5..a504019 100644 --- a/net/disk_cache/addr.h +++ b/net/disk_cache/addr.h @@ -5,11 +5,9 @@ // This is an internal class that handles the address of a cache record. // See net/disk_cache/disk_cache.h for the public interface of the cache. -#ifndef NET_DISK_CACHE_ADDR_H__ -#define NET_DISK_CACHE_ADDR_H__ +#ifndef NET_DISK_CACHE_ADDR_H_ +#define NET_DISK_CACHE_ADDR_H_ -#include "base/basictypes.h" -#include "base/logging.h" #include "net/disk_cache/disk_format.h" namespace disk_cache { @@ -87,24 +85,9 @@ class Addr { return ((value_ & kFileSelectorMask) >> kFileSelectorOffset); } - int start_block() const { - DCHECK(is_block_file()); - return value_ & kStartBlockMask; - } - - int num_blocks() const { - DCHECK(is_block_file() || !value_); - return ((value_ & kNumBlocksMask) >> kNumBlocksOffset) + 1; - } - - bool SetFileNumber(int file_number) { - DCHECK(is_separate_file()); - if (file_number & ~kFileNameMask) - return false; - value_ = kInitializedMask | file_number; - return true; - } - + int start_block() const; + int num_blocks() const; + bool SetFileNumber(int file_number); int BlockSize() const { return BlockSizeForFileType(file_type()); } @@ -151,5 +134,4 @@ class Addr { } // namespace disk_cache -#endif // NET_DISK_CACHE_ADDR_H__ - +#endif // NET_DISK_CACHE_ADDR_H_ diff --git a/net/disk_cache/rankings.h b/net/disk_cache/rankings.h index 1434235..d4c10afd 100644 --- a/net/disk_cache/rankings.h +++ b/net/disk_cache/rankings.h @@ -9,6 +9,7 @@ #include <list> +#include "base/scoped_ptr.h" #include "net/disk_cache/addr.h" #include "net/disk_cache/mapped_file.h" #include "net/disk_cache/storage_block.h" diff --git a/net/disk_cache/storage_block-inl.h b/net/disk_cache/storage_block-inl.h index 2082b0a..485a1b1 100644 --- a/net/disk_cache/storage_block-inl.h +++ b/net/disk_cache/storage_block-inl.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_DISK_CACHE_CACHE_INTERNAL_INL_H__ -#define NET_DISK_CACHE_CACHE_INTERNAL_INL_H__ +#ifndef NET_DISK_CACHE_CACHE_INTERNAL_INL_H_ +#define NET_DISK_CACHE_CACHE_INTERNAL_INL_H_ #include "net/disk_cache/storage_block.h" +#include "base/logging.h" #include "net/disk_cache/trace.h" namespace disk_cache { @@ -132,5 +133,4 @@ template<typename T> void StorageBlock<T>::DeleteData() { } // namespace disk_cache -#endif // NET_DISK_CACHE_CACHE_INTERNAL_INL_H__ - +#endif // NET_DISK_CACHE_CACHE_INTERNAL_INL_H_ |