Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: net/disk_cache/net_log_parameters.h

Issue 10543114: NetLogEventParameter to Callback refactoring 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update comment in response to comment Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/mem_entry_impl.cc ('k') | net/disk_cache/net_log_parameters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/net_log_parameters.h
===================================================================
--- net/disk_cache/net_log_parameters.h (revision 141669)
+++ net/disk_cache/net_log_parameters.h (working copy)
@@ -10,108 +10,54 @@
#include "net/base/net_log.h"
-// This file contains a set of NetLog::EventParameters shared by EntryImpls and
-// MemEntryImpls.
+// This file contains a set of functions to create NetLog::ParametersCallbacks
+// 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 base::Value* ToValue() const OVERRIDE;
+class Entry;
- protected:
- virtual ~EntryCreationParameters();
+// Creates a NetLog callback that returns parameters for the creation of an
+// Entry. Contains the Entry's key and whether it was created or opened.
+// |entry| can't be NULL, must support GetKey(), and must outlive the returned
+// callback.
+net::NetLog::ParametersCallback CreateNetLogEntryCreationCallback(
+ const Entry* entry,
+ bool created);
- private:
- const std::string key_;
- const bool created_;
+// Creates a NetLog callback that returns parameters for start of a non-sparse
+// read or write of an Entry. For reads, |truncate| must be false.
+net::NetLog::ParametersCallback CreateNetLogReadWriteDataCallback(
+ int index,
+ int offset,
+ int buf_len,
+ bool truncate);
- DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters);
-};
+// Creates a NetLog callback that returns parameters for when a non-sparse
+// read or write completes. For reads, |truncate| must be false.
+// |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.
+net::NetLog::ParametersCallback CreateNetLogReadWriteCompleteCallback(
+ int bytes_copied);
-// 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 base::Value* ToValue() const OVERRIDE;
+// Creates a NetLog callback that returns parameters for when a sparse
+// operation is started.
+net::NetLog::ParametersCallback CreateNetLogSparseOperationCallback(
+ int64 offset,
+ int buff_len);
- protected:
- virtual ~ReadWriteDataParameters();
+// Creates a NetLog callback that returns parameters for when a read or write
+// for a sparse entry's child is started.
+net::NetLog::ParametersCallback CreateNetLogSparseReadWriteCallback(
+ const net::NetLog::Source& source,
+ int child_len);
- private:
- const int index_;
- const int offset_;
- const int buf_len_;
- const bool truncate_;
+// Creates a NetLog callback that returns parameters for when a call to
+// GetAvailableRange returns.
+net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback(
+ int64 start,
+ int result);
- 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 base::Value* ToValue() const OVERRIDE;
-
- protected:
- virtual ~ReadWriteCompleteParameters();
-
- 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 base::Value* ToValue() const OVERRIDE;
-
- protected:
- virtual ~SparseOperationParameters();
-
- 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 base::Value* ToValue() const OVERRIDE;
-
- protected:
- virtual ~SparseReadWriteParameters();
-
- 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 base::Value* ToValue() const OVERRIDE;
-
- protected:
- virtual ~GetAvailableRangeResultParameters();
-
- private:
- const int64 start_;
- const int result_;
-};
-
} // namespace disk_cache
#endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_
« no previous file with comments | « net/disk_cache/mem_entry_impl.cc ('k') | net/disk_cache/net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698