OLD | NEW |
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/macros.h" | 10 #include "base/macros.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 READ_COMPLETE, | 54 READ_COMPLETE, |
55 WAIT_FOR_DATA_READY_DONE, | 55 WAIT_FOR_DATA_READY_DONE, |
56 CREATE_OR_OPEN, | 56 CREATE_OR_OPEN, |
57 CREATE_OR_OPEN_COMPLETE, | 57 CREATE_OR_OPEN_COMPLETE, |
58 WRITE, | 58 WRITE, |
59 WRITE_COMPLETE, | 59 WRITE_COMPLETE, |
60 SET_DONE, | 60 SET_DONE, |
61 NONE, | 61 NONE, |
62 }; | 62 }; |
63 | 63 |
64 // Enum to track number of times data read/parse/write API calls of | |
65 // QuicServerInfo to and from disk cache is called. | |
66 enum QuicServerInfoAPICall { | |
67 QUIC_SERVER_INFO_START = 0, | |
68 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1, | |
69 QUIC_SERVER_INFO_PARSE = 2, | |
70 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3, | |
71 QUIC_SERVER_INFO_READY_TO_PERSIST = 4, | |
72 QUIC_SERVER_INFO_PERSIST = 5, | |
73 QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6, | |
74 QUIC_SERVER_INFO_NUM_OF_API_CALLS = 7, | |
75 }; | |
76 | |
77 // Enum to track failure reasons to read/load/write of QuicServerInfo to | |
78 // and from disk cache. | |
79 enum FailureReason { | |
80 WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0, | |
81 GET_BACKEND_FAILURE = 1, | |
82 OPEN_FAILURE = 2, | |
83 CREATE_OR_OPEN_FAILURE = 3, | |
84 PARSE_NO_DATA_FAILURE = 4, | |
85 PARSE_FAILURE = 5, | |
86 READ_FAILURE = 6, | |
87 READY_TO_PERSIST_FAILURE = 7, | |
88 PERSIST_NO_BACKEND_FAILURE = 8, | |
89 WRITE_FAILURE = 9, | |
90 NO_FAILURE = 10, | |
91 NUM_OF_FAILURES = 11, | |
92 }; | |
93 | |
94 ~DiskCacheBasedQuicServerInfo() override; | 64 ~DiskCacheBasedQuicServerInfo() override; |
95 | 65 |
96 // Persists |pending_write_data_| if it is not empty, otherwise serializes the | 66 // Persists |pending_write_data_| if it is not empty, otherwise serializes the |
97 // data and pesists it. | 67 // data and pesists it. |
98 void PersistInternal(); | 68 void PersistInternal(); |
99 | 69 |
100 std::string key() const; | 70 std::string key() const; |
101 | 71 |
102 // The |unused| parameter is a small hack so that we can have the | 72 // The |unused| parameter is a small hack so that we can have the |
103 // CacheOperationDataShim object owned by the Callback that is created for | 73 // CacheOperationDataShim object owned by the Callback that is created for |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 FailureReason last_failure_; | 125 FailureReason last_failure_; |
156 | 126 |
157 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; | 127 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; |
158 | 128 |
159 DISALLOW_COPY_AND_ASSIGN(DiskCacheBasedQuicServerInfo); | 129 DISALLOW_COPY_AND_ASSIGN(DiskCacheBasedQuicServerInfo); |
160 }; | 130 }; |
161 | 131 |
162 } // namespace net | 132 } // namespace net |
163 | 133 |
164 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ | 134 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ |
OLD | NEW |