| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ | 5 #ifndef NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ |
| 6 #define NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ | 6 #define NET_DISK_CACHE_NET_LOG_PARAMETERS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "net/base/net_log.h" | 11 #include "net/base/net_log.h" |
| 12 | 12 |
| 13 // This file contains a set of NetLog::EventParameters shared by EntryImpls and | 13 // This file contains a set of NetLog::EventParameters shared by EntryImpls and |
| 14 // MemEntryImpls. | 14 // MemEntryImpls. |
| 15 namespace disk_cache { | 15 namespace disk_cache { |
| 16 | 16 |
| 17 // NetLog parameters for the creation of an Entry. Contains the Entry's name | 17 // NetLog parameters for the creation of an Entry. Contains the Entry's name |
| 18 // and whether it was created or opened. | 18 // and whether it was created or opened. |
| 19 class EntryCreationParameters : public net::NetLog::EventParameters { | 19 class EntryCreationParameters : public net::NetLog::EventParameters { |
| 20 public: | 20 public: |
| 21 EntryCreationParameters(const std::string& key, bool created); | 21 EntryCreationParameters(const std::string& key, bool created); |
| 22 virtual base::Value* ToValue() const OVERRIDE; | 22 virtual base::Value* ToValue() const OVERRIDE; |
| 23 | 23 |
| 24 protected: |
| 25 virtual ~EntryCreationParameters(); |
| 26 |
| 24 private: | 27 private: |
| 25 const std::string key_; | 28 const std::string key_; |
| 26 const bool created_; | 29 const bool created_; |
| 27 | 30 |
| 28 DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); | 31 DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); |
| 29 }; | 32 }; |
| 30 | 33 |
| 31 // NetLog parameters for non-sparse reading and writing to an Entry. | 34 // NetLog parameters for non-sparse reading and writing to an Entry. |
| 32 class ReadWriteDataParameters : public net::NetLog::EventParameters { | 35 class ReadWriteDataParameters : public net::NetLog::EventParameters { |
| 33 public: | 36 public: |
| 34 // For reads, |truncate| must be false. | 37 // For reads, |truncate| must be false. |
| 35 ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); | 38 ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); |
| 36 virtual base::Value* ToValue() const OVERRIDE; | 39 virtual base::Value* ToValue() const OVERRIDE; |
| 37 | 40 |
| 41 protected: |
| 42 virtual ~ReadWriteDataParameters(); |
| 43 |
| 38 private: | 44 private: |
| 39 const int index_; | 45 const int index_; |
| 40 const int offset_; | 46 const int offset_; |
| 41 const int buf_len_; | 47 const int buf_len_; |
| 42 const bool truncate_; | 48 const bool truncate_; |
| 43 | 49 |
| 44 DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParameters); | 50 DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParameters); |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 // NetLog parameters for when a non-sparse read or write completes. | 53 // NetLog parameters for when a non-sparse read or write completes. |
| 48 class ReadWriteCompleteParameters : public net::NetLog::EventParameters { | 54 class ReadWriteCompleteParameters : public net::NetLog::EventParameters { |
| 49 public: | 55 public: |
| 50 // |bytes_copied| is either the number of bytes copied or a network error | 56 // |bytes_copied| is either the number of bytes copied or a network error |
| 51 // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid | 57 // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid |
| 52 // result for an operation. | 58 // result for an operation. |
| 53 explicit ReadWriteCompleteParameters(int bytes_copied); | 59 explicit ReadWriteCompleteParameters(int bytes_copied); |
| 54 virtual base::Value* ToValue() const OVERRIDE; | 60 virtual base::Value* ToValue() const OVERRIDE; |
| 55 | 61 |
| 62 protected: |
| 63 virtual ~ReadWriteCompleteParameters(); |
| 64 |
| 56 private: | 65 private: |
| 57 const int bytes_copied_; | 66 const int bytes_copied_; |
| 58 | 67 |
| 59 DISALLOW_COPY_AND_ASSIGN(ReadWriteCompleteParameters); | 68 DISALLOW_COPY_AND_ASSIGN(ReadWriteCompleteParameters); |
| 60 }; | 69 }; |
| 61 | 70 |
| 62 // NetLog parameters for when a sparse operation is started. | 71 // NetLog parameters for when a sparse operation is started. |
| 63 class SparseOperationParameters : public net::NetLog::EventParameters { | 72 class SparseOperationParameters : public net::NetLog::EventParameters { |
| 64 public: | 73 public: |
| 65 SparseOperationParameters(int64 offset, int buff_len); | 74 SparseOperationParameters(int64 offset, int buff_len); |
| 66 virtual base::Value* ToValue() const OVERRIDE; | 75 virtual base::Value* ToValue() const OVERRIDE; |
| 67 | 76 |
| 77 protected: |
| 78 virtual ~SparseOperationParameters(); |
| 79 |
| 68 private: | 80 private: |
| 69 const int64 offset_; | 81 const int64 offset_; |
| 70 const int buff_len_; | 82 const int buff_len_; |
| 71 }; | 83 }; |
| 72 | 84 |
| 73 // NetLog parameters for when a read or write for a sparse entry's child is | 85 // NetLog parameters for when a read or write for a sparse entry's child is |
| 74 // started. | 86 // started. |
| 75 class SparseReadWriteParameters : public net::NetLog::EventParameters { | 87 class SparseReadWriteParameters : public net::NetLog::EventParameters { |
| 76 public: | 88 public: |
| 77 SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); | 89 SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); |
| 78 virtual base::Value* ToValue() const OVERRIDE; | 90 virtual base::Value* ToValue() const OVERRIDE; |
| 79 | 91 |
| 92 protected: |
| 93 virtual ~SparseReadWriteParameters(); |
| 94 |
| 80 private: | 95 private: |
| 81 const net::NetLog::Source source_; | 96 const net::NetLog::Source source_; |
| 82 const int child_len_; | 97 const int child_len_; |
| 83 }; | 98 }; |
| 84 | 99 |
| 85 // NetLog parameters for when a call to GetAvailableRange returns. | 100 // NetLog parameters for when a call to GetAvailableRange returns. |
| 86 class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { | 101 class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { |
| 87 public: | 102 public: |
| 88 // |start| is ignored when |result| < 0. | 103 // |start| is ignored when |result| < 0. |
| 89 GetAvailableRangeResultParameters(int64 start, int result); | 104 GetAvailableRangeResultParameters(int64 start, int result); |
| 90 virtual base::Value* ToValue() const OVERRIDE; | 105 virtual base::Value* ToValue() const OVERRIDE; |
| 91 | 106 |
| 107 protected: |
| 108 virtual ~GetAvailableRangeResultParameters(); |
| 109 |
| 92 private: | 110 private: |
| 93 const int64 start_; | 111 const int64 start_; |
| 94 const int result_; | 112 const int result_; |
| 95 }; | 113 }; |
| 96 | 114 |
| 97 } // namespace disk_cache | 115 } // namespace disk_cache |
| 98 | 116 |
| 99 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ | 117 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ |
| OLD | NEW |