OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "net/log/net_log.h" | 12 #include "net/log/net_log_parameters_callback.h" |
13 | 13 |
14 // This file contains a set of functions to create NetLog::ParametersCallbacks | 14 namespace net { |
| 15 struct NetLogSource; |
| 16 } |
| 17 |
| 18 // This file contains a set of functions to create NetLogParametersCallbacks |
15 // shared by EntryImpls and MemEntryImpls. | 19 // shared by EntryImpls and MemEntryImpls. |
16 namespace disk_cache { | 20 namespace disk_cache { |
17 | 21 |
18 class Entry; | 22 class Entry; |
19 | 23 |
20 // Creates a NetLog callback that returns parameters for the creation of an | 24 // Creates a NetLog callback that returns parameters for the creation of an |
21 // Entry. Contains the Entry's key and whether it was created or opened. | 25 // Entry. Contains the Entry's key and whether it was created or opened. |
22 // |entry| can't be NULL, must support GetKey(), and must outlive the returned | 26 // |entry| can't be NULL, must support GetKey(), and must outlive the returned |
23 // callback. | 27 // callback. |
24 net::NetLog::ParametersCallback CreateNetLogEntryCreationCallback( | 28 net::NetLogParametersCallback CreateNetLogEntryCreationCallback( |
25 const Entry* entry, | 29 const Entry* entry, |
26 bool created); | 30 bool created); |
27 | 31 |
28 // Creates a NetLog callback that returns parameters for start of a non-sparse | 32 // Creates a NetLog callback that returns parameters for start of a non-sparse |
29 // read or write of an Entry. For reads, |truncate| must be false. | 33 // read or write of an Entry. For reads, |truncate| must be false. |
30 net::NetLog::ParametersCallback CreateNetLogReadWriteDataCallback( | 34 net::NetLogParametersCallback CreateNetLogReadWriteDataCallback(int index, |
31 int index, | 35 int offset, |
32 int offset, | 36 int buf_len, |
33 int buf_len, | 37 bool truncate); |
34 bool truncate); | |
35 | 38 |
36 // Creates a NetLog callback that returns parameters for when a non-sparse | 39 // Creates a NetLog callback that returns parameters for when a non-sparse |
37 // read or write completes. For reads, |truncate| must be false. | 40 // read or write completes. For reads, |truncate| must be false. |
38 // |bytes_copied| is either the number of bytes copied or a network error | 41 // |bytes_copied| is either the number of bytes copied or a network error |
39 // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid | 42 // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid |
40 // result for an operation. | 43 // result for an operation. |
41 net::NetLog::ParametersCallback CreateNetLogReadWriteCompleteCallback( | 44 net::NetLogParametersCallback CreateNetLogReadWriteCompleteCallback( |
42 int bytes_copied); | 45 int bytes_copied); |
43 | 46 |
44 // Creates a NetLog callback that returns parameters for when a sparse | 47 // Creates a NetLog callback that returns parameters for when a sparse |
45 // operation is started. | 48 // operation is started. |
46 net::NetLog::ParametersCallback CreateNetLogSparseOperationCallback( | 49 net::NetLogParametersCallback CreateNetLogSparseOperationCallback( |
47 int64_t offset, | 50 int64_t offset, |
48 int buf_len); | 51 int buf_len); |
49 | 52 |
50 // Creates a NetLog callback that returns parameters for when a read or write | 53 // Creates a NetLog callback that returns parameters for when a read or write |
51 // for a sparse entry's child is started. | 54 // for a sparse entry's child is started. |
52 net::NetLog::ParametersCallback CreateNetLogSparseReadWriteCallback( | 55 net::NetLogParametersCallback CreateNetLogSparseReadWriteCallback( |
53 const net::NetLog::Source& source, | 56 const net::NetLogSource& source, |
54 int child_len); | 57 int child_len); |
55 | 58 |
56 // Creates a NetLog callback that returns parameters for when a call to | 59 // Creates a NetLog callback that returns parameters for when a call to |
57 // GetAvailableRange returns. | 60 // GetAvailableRange returns. |
58 net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback( | 61 net::NetLogParametersCallback CreateNetLogGetAvailableRangeResultCallback( |
59 int64_t start, | 62 int64_t start, |
60 int result); | 63 int result); |
61 | 64 |
62 } // namespace disk_cache | 65 } // namespace disk_cache |
63 | 66 |
64 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ | 67 #endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ |
OLD | NEW |