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