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