diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 18:53:02 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-17 18:53:02 +0000 |
commit | 9eb8cdff6c4e93d2609ee9a12cbd6b3dfa8b7d7f (patch) | |
tree | a3024687f2041d1f464aeb073d289c1bb7daae74 /net/disk_cache/net_log_parameters.h | |
parent | d767b2c624529faef3bf78230f8873e91b244868 (diff) | |
download | chromium_src-9eb8cdff6c4e93d2609ee9a12cbd6b3dfa8b7d7f.zip chromium_src-9eb8cdff6c4e93d2609ee9a12cbd6b3dfa8b7d7f.tar.gz chromium_src-9eb8cdff6c4e93d2609ee9a12cbd6b3dfa8b7d7f.tar.bz2 |
Adds memory cache logging, and updates disk cache logging.
Memory and disk cache use the same set of events, with the same parameters (Though the disk cache has a couple events the memory cache does not). Most disk cache events were renamed so as to no longer imply a connection to the disk cache, and all disk cache-related NetLog parameter class definitions were moved to a new file, since they're shared by both entry type.
BUG=59382
TEST=none
Review URL: http://codereview.chromium.org/6613027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/net_log_parameters.h')
-rw-r--r-- | net/disk_cache/net_log_parameters.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/net/disk_cache/net_log_parameters.h b/net/disk_cache/net_log_parameters.h new file mode 100644 index 0000000..f708c79 --- /dev/null +++ b/net/disk_cache/net_log_parameters.h @@ -0,0 +1,99 @@ +// 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. + +#ifndef NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ +#define NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ +#pragma once + +#include <string> + +#include "net/base/net_log.h" + +// This file contains a set of NetLog::EventParameters shared by EntryImpls and +// MemEntryImpls. +namespace disk_cache { + +// NetLog parameters for the creation of an Entry. Contains the Entry's name +// and whether it was created or opened. +class EntryCreationParameters : public net::NetLog::EventParameters { + public: + EntryCreationParameters(const std::string& key, bool created); + virtual Value* ToValue() const; + + private: + const std::string key_; + const bool created_; + + DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); +}; + +// NetLog parameters for non-sparse reading and writing to an Entry. +class ReadWriteDataParameters : public net::NetLog::EventParameters { + public: + // For reads, |truncate| must be false. + ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); + virtual Value* ToValue() const; + + private: + const int index_; + const int offset_; + const int buf_len_; + const bool truncate_; + + DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParameters); +}; + +// NetLog parameters for when a non-sparse read or write completes. +class ReadWriteCompleteParameters : public net::NetLog::EventParameters { + public: + // |bytes_copied| is either the number of bytes copied or a network error + // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid + // result for an operation. + explicit ReadWriteCompleteParameters(int bytes_copied); + virtual Value* ToValue() const; + + private: + const int bytes_copied_; + + DISALLOW_COPY_AND_ASSIGN(ReadWriteCompleteParameters); +}; + +// NetLog parameters for when a sparse operation is started. +class SparseOperationParameters : public net::NetLog::EventParameters { + public: + SparseOperationParameters(int64 offset, int buff_len); + virtual Value* ToValue() const; + + private: + const int64 offset_; + const int buff_len_; +}; + +// NetLog parameters for when a read or write for a sparse entry's child is +// started. +class SparseReadWriteParameters : public net::NetLog::EventParameters { + public: + SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); + virtual Value* ToValue() const; + + private: + const net::NetLog::Source source_; + const int child_len_; +}; + +// NetLog parameters for when a call to GetAvailableRange returns. +class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { + public: + // |start| is ignored when |result| < 0. + GetAvailableRangeResultParameters(int64 start, int result); + virtual Value* ToValue() const; + + private: + const int64 start_; + const int result_; +}; + +} // namespace disk_cache + +#endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ |