summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/entry_impl.h
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-24 16:24:13 +0100
committerKristian Monsen <kristianm@google.com>2011-05-25 14:13:32 +0100
commit3f50c38dc070f4bb515c1b64450dae14f316474e (patch)
tree29f309f9534e05c47244eedb438fc612578d133b /net/disk_cache/entry_impl.h
parente23bef148f7be2bdf9c3cb2cd3aa5ceebf1190fb (diff)
downloadexternal_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.zip
external_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.tar.gz
external_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.tar.bz2
Merge Chromium at r10.0.634.0: Initial merge by git.
Change-Id: Iac2af492818d119bcc2562eb5fdabf5ab0b6df9c
Diffstat (limited to 'net/disk_cache/entry_impl.h')
-rw-r--r--net/disk_cache/entry_impl.h62
1 files changed, 40 insertions, 22 deletions
diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h
index e27f23a..e56fc6b 100644
--- a/net/disk_cache/entry_impl.h
+++ b/net/disk_cache/entry_impl.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/scoped_ptr.h"
+#include "net/base/net_log.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/storage_block.h"
#include "net/disk_cache/storage_block-inl.h"
@@ -32,28 +33,6 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
EntryImpl(BackendImpl* backend, Addr address, bool read_only);
- // Entry interface.
- virtual void Doom();
- virtual void Close();
- virtual std::string GetKey() const;
- virtual base::Time GetLastUsed() const;
- virtual base::Time GetLastModified() const;
- virtual int32 GetDataSize(int index) const;
- virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback,
- bool truncate);
- virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int GetAvailableRange(int64 offset, int len, int64* start,
- CompletionCallback* callback);
- virtual bool CouldBeSparse() const;
- virtual void CancelSparseIO();
- virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback);
-
// Background implementation of the Entry interface.
void DoomImpl();
int ReadDataImpl(int index, int offset, net::IOBuffer* buf, int buf_len,
@@ -129,6 +108,36 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
// Generates a histogram for the time spent working on this operation.
void ReportIOTime(Operation op, const base::TimeTicks& start);
+ // Logs a begin event and enables logging for the EntryImpl. Will also cause
+ // an end event to be logged on destruction. The EntryImpl must have its key
+ // initialized before this is called. |created| is true if the Entry was
+ // created rather than opened.
+ void BeginLogging(net::NetLog* net_log, bool created);
+
+ const net::BoundNetLog& net_log() const;
+
+ // Entry interface.
+ virtual void Doom();
+ virtual void Close();
+ virtual std::string GetKey() const;
+ virtual base::Time GetLastUsed() const;
+ virtual base::Time GetLastModified() const;
+ virtual int32 GetDataSize(int index) const;
+ virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback,
+ bool truncate);
+ virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int GetAvailableRange(int64 offset, int len, int64* start,
+ CompletionCallback* callback);
+ virtual bool CouldBeSparse() const;
+ virtual void CancelSparseIO();
+ virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback);
+
private:
enum {
kNumStreams = 3
@@ -137,6 +146,13 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
~EntryImpl();
+ // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as
+ // separate functions to make logging of results simpler.
+ int InternalReadData(int index, int offset, net::IOBuffer* buf,
+ int buf_len, CompletionCallback* callback);
+ int InternalWriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ CompletionCallback* callback, bool truncate);
+
// Initializes the storage for an internal or external data block.
bool CreateDataBlock(int index, int size);
@@ -220,6 +236,8 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> {
bool read_only_; // True if not yet writing.
scoped_ptr<SparseControl> sparse_; // Support for sparse entries.
+ net::BoundNetLog net_log_;
+
DISALLOW_COPY_AND_ASSIGN(EntryImpl);
};