summaryrefslogtreecommitdiff
path: root/chromium/net/disk_cache/net_log_parameters.h
blob: 6e144201c8e8cf91b9c47dfcc3323ffedbbc70b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_DISK_CACHE_NET_LOG_PARAMETERS_H_
#define NET_DISK_CACHE_NET_LOG_PARAMETERS_H_

#include <string>

#include "net/log/net_log.h"

// This file contains a set of functions to create NetLog::ParametersCallbacks
// shared by EntryImpls and MemEntryImpls.
namespace disk_cache {

class Entry;

// Creates a NetLog callback that returns parameters for the creation of an
// Entry.  Contains the Entry's key and whether it was created or opened.
// |entry| can't be NULL, must support GetKey(), and must outlive the returned
// callback.
net::NetLog::ParametersCallback CreateNetLogEntryCreationCallback(
    const Entry* entry,
    bool created);

// Creates a NetLog callback that returns parameters for start of a non-sparse
// read or write of an Entry.  For reads, |truncate| must be false.
net::NetLog::ParametersCallback CreateNetLogReadWriteDataCallback(
    int index,
    int offset,
    int buf_len,
    bool truncate);

// Creates a NetLog callback that returns parameters for when a non-sparse
// read or write completes.  For reads, |truncate| must be false.
// |bytes_copied| is either the number of bytes copied or a network error
// code.  |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid
// result for an operation.
net::NetLog::ParametersCallback CreateNetLogReadWriteCompleteCallback(
    int bytes_copied);

// Creates a NetLog callback that returns parameters for when a sparse
// operation is started.
net::NetLog::ParametersCallback CreateNetLogSparseOperationCallback(
    int64 offset,
    int buff_len);

// Creates a NetLog callback that returns parameters for when a read or write
// for a sparse entry's child is started.
net::NetLog::ParametersCallback CreateNetLogSparseReadWriteCallback(
    const net::NetLog::Source& source,
    int child_len);

// Creates a NetLog callback that returns parameters for when a call to
// GetAvailableRange returns.
net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback(
    int64 start,
    int result);

}  // namespace disk_cache

#endif  // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_