| 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 private: | 24 private: |
| 25 virtual ~EntryCreationParameters(); |
| 26 |
| 25 const std::string key_; | 27 const std::string key_; |
| 26 const bool created_; | 28 const bool created_; |
| 27 | 29 |
| 28 DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); | 30 DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters); |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 // NetLog parameters for non-sparse reading and writing to an Entry. | 33 // NetLog parameters for non-sparse reading and writing to an Entry. |
| 32 class ReadWriteDataParameters : public net::NetLog::EventParameters { | 34 class ReadWriteDataParameters : public net::NetLog::EventParameters { |
| 33 public: | 35 public: |
| 34 // For reads, |truncate| must be false. | 36 // For reads, |truncate| must be false. |
| 35 ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); | 37 ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); |
| 36 virtual base::Value* ToValue() const OVERRIDE; | 38 virtual base::Value* ToValue() const OVERRIDE; |
| 37 | 39 |
| 38 private: | 40 private: |
| 41 virtual ~ReadWriteDataParameters(); |
| 42 |
| 39 const int index_; | 43 const int index_; |
| 40 const int offset_; | 44 const int offset_; |
| 41 const int buf_len_; | 45 const int buf_len_; |
| 42 const bool truncate_; | 46 const bool truncate_; |
| 43 | 47 |
| 44 DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParameters); | 48 DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParameters); |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 // NetLog parameters for when a non-sparse read or write completes. | 51 // NetLog parameters for when a non-sparse read or write completes. |
| 48 class ReadWriteCompleteParameters : public net::NetLog::EventParameters { | 52 class ReadWriteCompleteParameters : public net::NetLog::EventParameters { |
| 49 public: | 53 public: |
| 50 // |bytes_copied| is either the number of bytes copied or a network error | 54 // |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 | 55 // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid |
| 52 // result for an operation. | 56 // result for an operation. |
| 53 explicit ReadWriteCompleteParameters(int bytes_copied); | 57 explicit ReadWriteCompleteParameters(int bytes_copied); |
| 54 virtual base::Value* ToValue() const OVERRIDE; | 58 virtual base::Value* ToValue() const OVERRIDE; |
| 55 | 59 |
| 56 private: | 60 private: |
| 61 virtual ~ReadWriteCompleteParameters(); |
| 62 |
| 57 const int bytes_copied_; | 63 const int bytes_copied_; |
| 58 | 64 |
| 59 DISALLOW_COPY_AND_ASSIGN(ReadWriteCompleteParameters); | 65 DISALLOW_COPY_AND_ASSIGN(ReadWriteCompleteParameters); |
| 60 }; | 66 }; |
| 61 | 67 |
| 62 // NetLog parameters for when a sparse operation is started. | 68 // NetLog parameters for when a sparse operation is started. |
| 63 class SparseOperationParameters : public net::NetLog::EventParameters { | 69 class SparseOperationParameters : public net::NetLog::EventParameters { |
| 64 public: | 70 public: |
| 65 SparseOperationParameters(int64 offset, int buff_len); | 71 SparseOperationParameters(int64 offset, int buff_len); |
| 66 virtual base::Value* ToValue() const OVERRIDE; | 72 virtual base::Value* ToValue() const OVERRIDE; |
| 67 | 73 |
| 68 private: | 74 private: |
| 75 virtual ~SparseOperationParameters(); |
| 76 |
| 69 const int64 offset_; | 77 const int64 offset_; |
| 70 const int buff_len_; | 78 const int buff_len_; |
| 71 }; | 79 }; |
| 72 | 80 |
| 73 // NetLog parameters for when a read or write for a sparse entry's child is | 81 // NetLog parameters for when a read or write for a sparse entry's child is |
| 74 // started. | 82 // started. |
| 75 class SparseReadWriteParameters : public net::NetLog::EventParameters { | 83 class SparseReadWriteParameters : public net::NetLog::EventParameters { |
| 76 public: | 84 public: |
| 77 SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); | 85 SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); |
| 78 virtual base::Value* ToValue() const OVERRIDE; | 86 virtual base::Value* ToValue() const OVERRIDE; |
| 79 | 87 |
| 80 private: | 88 private: |
| 89 virtual ~SparseReadWriteParameters(); |
| 90 |
| 81 const net::NetLog::Source source_; | 91 const net::NetLog::Source source_; |
| 82 const int child_len_; | 92 const int child_len_; |
| 83 }; | 93 }; |
| 84 | 94 |
| 85 // NetLog parameters for when a call to GetAvailableRange returns. | 95 // NetLog parameters for when a call to GetAvailableRange returns. |
| 86 class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { | 96 class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { |
| 87 public: | 97 public: |
| 88 // |start| is ignored when |result| < 0. | 98 // |start| is ignored when |result| < 0. |
| 89 GetAvailableRangeResultParameters(int64 start, int result); | 99 GetAvailableRangeResultParameters(int64 start, int result); |
| 90 virtual base::Value* ToValue() const OVERRIDE; | 100 virtual base::Value* ToValue() const OVERRIDE; |
| 91 | 101 |
| 92 private: | 102 private: |
| 103 virtual ~GetAvailableRangeResultParameters(); |
| 104 |
| 93 const int64 start_; | 105 const int64 start_; |
| 94 const int result_; | 106 const int result_; |
| 95 }; | 107 }; |
| 96 | 108 |
| 97 } // namespace disk_cache | 109 } // namespace disk_cache |
| 98 | 110 |
| 99 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ | 111 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ |
| OLD | NEW |