net_log_parameters.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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
  3. // found in the LICENSE file.
  4. #ifndef NET_DISK_CACHE_NET_LOG_PARAMETERS_H_
  5. #define NET_DISK_CACHE_NET_LOG_PARAMETERS_H_
  6. #include <stdint.h>
  7. #include "net/disk_cache/disk_cache.h"
  8. #include "net/log/net_log_with_source.h"
  9. namespace net {
  10. struct NetLogSource;
  11. }
  12. namespace base {
  13. class Value;
  14. }
  15. // This file contains a set of functions to create NetLogParametersCallbacks
  16. // shared by EntryImpls and MemEntryImpls.
  17. namespace disk_cache {
  18. class Entry;
  19. // Creates NetLog parameters for the creation of an Entry. Contains the Entry's
  20. // key and whether it was created or opened. |entry| can't be nullptr, must
  21. // support GetKey().
  22. base::Value CreateNetLogParametersEntryCreationParams(const Entry* entry,
  23. bool created);
  24. // Logs an event for the start of a non-sparse read or write of an Entry. For
  25. // reads, |truncate| must be false.
  26. void NetLogReadWriteData(const net::NetLogWithSource& net_log,
  27. net::NetLogEventType type,
  28. net::NetLogEventPhase phase,
  29. int index,
  30. int offset,
  31. int buf_len,
  32. bool truncate);
  33. // Logs an event for when a non-sparse read or write completes. For reads,
  34. // |truncate| must be false. |bytes_copied| is either the number of bytes copied
  35. // or a network error code. |bytes_copied| must not be ERR_IO_PENDING, as it's
  36. // not a valid result for an operation.
  37. void NetLogReadWriteComplete(const net::NetLogWithSource& net_log,
  38. net::NetLogEventType type,
  39. net::NetLogEventPhase phase,
  40. int bytes_copied);
  41. // Logs an event for when a sparse operation is started.
  42. void NetLogSparseOperation(const net::NetLogWithSource& net_log,
  43. net::NetLogEventType type,
  44. net::NetLogEventPhase phase,
  45. int64_t offset,
  46. int buf_len);
  47. // Logs an event for when a read or write for a sparse entry's child is started.
  48. void NetLogSparseReadWrite(const net::NetLogWithSource& net_log,
  49. net::NetLogEventType type,
  50. net::NetLogEventPhase phase,
  51. const net::NetLogSource& source,
  52. int child_len);
  53. // Creates NetLog parameters for when a call to GetAvailableRange returns.
  54. base::Value CreateNetLogGetAvailableRangeResultParams(
  55. const disk_cache::RangeResult result);
  56. } // namespace disk_cache
  57. #endif // NET_DISK_CACHE_NET_LOG_PARAMETERS_H_