Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: net/http/disk_cache_based_quic_server_info.h

Issue 708033002: QUIC - track disk cache API calls and failure reasons in separate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged with TOT Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/http/disk_cache_based_quic_server_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ 5 #ifndef NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_
6 #define NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ 6 #define NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 24 matching lines...) Expand all
35 void Start() override; 35 void Start() override;
36 int WaitForDataReady(const CompletionCallback& callback) override; 36 int WaitForDataReady(const CompletionCallback& callback) override;
37 void CancelWaitForDataReadyCallback() override; 37 void CancelWaitForDataReadyCallback() override;
38 bool IsDataReady() override; 38 bool IsDataReady() override;
39 bool IsReadyToPersist() override; 39 bool IsReadyToPersist() override;
40 void Persist() override; 40 void Persist() override;
41 void OnExternalCacheHit() override; 41 void OnExternalCacheHit() override;
42 42
43 private: 43 private:
44 struct CacheOperationDataShim; 44 struct CacheOperationDataShim;
45
45 enum State { 46 enum State {
46 GET_BACKEND, 47 GET_BACKEND,
47 GET_BACKEND_COMPLETE, 48 GET_BACKEND_COMPLETE,
48 OPEN, 49 OPEN,
49 OPEN_COMPLETE, 50 OPEN_COMPLETE,
50 READ, 51 READ,
51 READ_COMPLETE, 52 READ_COMPLETE,
52 WAIT_FOR_DATA_READY_DONE, 53 WAIT_FOR_DATA_READY_DONE,
53 CREATE_OR_OPEN, 54 CREATE_OR_OPEN,
54 CREATE_OR_OPEN_COMPLETE, 55 CREATE_OR_OPEN_COMPLETE,
55 WRITE, 56 WRITE,
56 WRITE_COMPLETE, 57 WRITE_COMPLETE,
57 SET_DONE, 58 SET_DONE,
58 NONE, 59 NONE,
59 }; 60 };
60 61
62 // Enum to track number of times data read/parse/write API calls of
63 // QuicServerInfo to and from disk cache is called.
64 enum QuicServerInfoAPICall {
65 QUIC_SERVER_INFO_START = 0,
66 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1,
67 QUIC_SERVER_INFO_PARSE = 2,
68 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3,
69 QUIC_SERVER_INFO_READY_TO_PERSIST = 4,
70 QUIC_SERVER_INFO_PERSIST = 5,
71 QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6,
72 QUIC_SERVER_INFO_NUM_OF_API_CALLS = 7,
73 };
74
75 // Enum to track failure reasons to read/load/write of QuicServerInfo to
76 // and from disk cache.
77 enum FailureReason {
78 WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0,
79 GET_BACKEND_FAILURE = 1,
80 OPEN_FAILURE = 2,
81 CREATE_OR_OPEN_FAILURE = 3,
82 PARSE_NO_DATA_FAILURE = 4,
83 PARSE_FAILURE = 5,
84 READ_FAILURE = 6,
85 READY_TO_PERSIST_FAILURE = 7,
86 PERSIST_NO_BACKEND_FAILURE = 8,
87 WRITE_FAILURE = 9,
88 NUM_OF_FAILURES = 10,
89 };
90
61 ~DiskCacheBasedQuicServerInfo() override; 91 ~DiskCacheBasedQuicServerInfo() override;
62 92
63 std::string key() const; 93 std::string key() const;
64 94
65 // The |unused| parameter is a small hack so that we can have the 95 // The |unused| parameter is a small hack so that we can have the
66 // CacheOperationDataShim object owned by the Callback that is created for 96 // CacheOperationDataShim object owned by the Callback that is created for
67 // this method. See comment above CacheOperationDataShim for details. 97 // this method. See comment above CacheOperationDataShim for details.
68 void OnIOComplete(CacheOperationDataShim* unused, int rv); 98 void OnIOComplete(CacheOperationDataShim* unused, int rv);
69 99
70 int DoLoop(int rv); 100 int DoLoop(int rv);
71 101
72 int DoGetBackendComplete(int rv); 102 int DoGetBackendComplete(int rv);
73 int DoOpenComplete(int rv); 103 int DoOpenComplete(int rv);
74 int DoReadComplete(int rv); 104 int DoReadComplete(int rv);
75 int DoWriteComplete(int rv); 105 int DoWriteComplete(int rv);
76 int DoCreateOrOpenComplete(int rv); 106 int DoCreateOrOpenComplete(int rv);
77 107
78 int DoGetBackend(); 108 int DoGetBackend();
79 int DoOpen(); 109 int DoOpen();
80 int DoRead(); 110 int DoRead();
81 int DoWrite(); 111 int DoWrite();
82 int DoCreateOrOpen(); 112 int DoCreateOrOpen();
83 113
84 // DoWaitForDataReadyDone is the terminal state of the read operation. 114 // DoWaitForDataReadyDone is the terminal state of the read operation.
85 int DoWaitForDataReadyDone(); 115 int DoWaitForDataReadyDone();
86 116
87 // DoSetDone is the terminal state of the write operation. 117 // DoSetDone is the terminal state of the write operation.
88 int DoSetDone(); 118 int DoSetDone();
89 119
120 // Tracks in a histogram the number of times data read/parse/write API calls
121 // of QuicServerInfo to and from disk cache is called.
122 void RecordQuicServerInfoStatus(QuicServerInfoAPICall call);
123
124 // Tracks in a histogram the failure reasons to read/load/write of
125 // QuicServerInfo to and from disk cache.
126 void RecordQuicServerInfoFailure(FailureReason failure);
127
90 CacheOperationDataShim* data_shim_; // Owned by |io_callback_|. 128 CacheOperationDataShim* data_shim_; // Owned by |io_callback_|.
91 CompletionCallback io_callback_; 129 CompletionCallback io_callback_;
92 State state_; 130 State state_;
93 bool ready_; 131 bool ready_;
94 bool found_entry_; // Controls the behavior of DoCreateOrOpen. 132 bool found_entry_; // Controls the behavior of DoCreateOrOpen.
95 std::string new_data_; 133 std::string new_data_;
96 const QuicServerId server_id_; 134 const QuicServerId server_id_;
97 HttpCache* const http_cache_; 135 HttpCache* const http_cache_;
98 disk_cache::Backend* backend_; 136 disk_cache::Backend* backend_;
99 disk_cache::Entry* entry_; 137 disk_cache::Entry* entry_;
100 CompletionCallback user_callback_; 138 CompletionCallback user_callback_;
101 scoped_refptr<IOBuffer> read_buffer_; 139 scoped_refptr<IOBuffer> read_buffer_;
102 scoped_refptr<IOBuffer> write_buffer_; 140 scoped_refptr<IOBuffer> write_buffer_;
103 std::string data_; 141 std::string data_;
104 base::TimeTicks load_start_time_; 142 base::TimeTicks load_start_time_;
105 143
106 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; 144 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_;
107 }; 145 };
108 146
109 } // namespace net 147 } // namespace net
110 148
111 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ 149 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/disk_cache_based_quic_server_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698