| Index: net/quic/chromium/quic_server_info.h
|
| diff --git a/net/quic/chromium/quic_server_info.h b/net/quic/chromium/quic_server_info.h
|
| index a8185766bff5d2d3cb820c27a919a2a2f9ac29dd..eab5366d92961432124df90a25f2f649617db1f5 100644
|
| --- a/net/quic/chromium/quic_server_info.h
|
| +++ b/net/quic/chromium/quic_server_info.h
|
| @@ -24,6 +24,20 @@
|
| // crypto config.
|
| class QUIC_EXPORT_PRIVATE QuicServerInfo {
|
| public:
|
| + // Enum to track number of times data read/parse/write API calls of
|
| + // QuicServerInfo to and from disk cache is called.
|
| + enum QuicServerInfoAPICall {
|
| + QUIC_SERVER_INFO_START = 0,
|
| + QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1,
|
| + QUIC_SERVER_INFO_PARSE = 2,
|
| + QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3,
|
| + QUIC_SERVER_INFO_READY_TO_PERSIST = 4,
|
| + QUIC_SERVER_INFO_PERSIST = 5,
|
| + QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6,
|
| + QUIC_SERVER_INFO_RESET_WAIT_FOR_DATA_READY = 7,
|
| + QUIC_SERVER_INFO_NUM_OF_API_CALLS = 8,
|
| + };
|
| +
|
| // Enum to track failure reasons to read/load/write of QuicServerInfo to
|
| // and from disk cache.
|
| enum FailureReason {
|
| @@ -45,12 +59,48 @@
|
| explicit QuicServerInfo(const QuicServerId& server_id);
|
| virtual ~QuicServerInfo();
|
|
|
| - // Fetches the server config from the backing store, and returns true
|
| - // if the server config was found.
|
| - virtual bool Load() = 0;
|
| + // Start will commence the lookup. This must be called before any other
|
| + // methods. By opportunistically calling this early, it may be possible to
|
| + // overlap this object's lookup and reduce latency.
|
| + virtual void Start() = 0;
|
|
|
| - // Persist allows for the server information to be updated for future uses.
|
| + // WaitForDataReady returns OK if the fetch of the requested data has
|
| + // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on
|
| + // the current thread when ready.
|
| + //
|
| + // Only a single callback can be outstanding at a given time and, in the
|
| + // event that WaitForDataReady returns OK, it's the caller's responsibility
|
| + // to delete |callback|.
|
| + //
|
| + // |callback| may be NULL, in which case ERR_IO_PENDING may still be returned
|
| + // but, obviously, a callback will never be made.
|
| + virtual int WaitForDataReady(const CompletionCallback& callback) = 0;
|
| +
|
| + // Reset's WaitForDataReady callback. This method shouldn't have any side
|
| + // effects (could be called even if HttpCache doesn't exist).
|
| + virtual void ResetWaitForDataReadyCallback() = 0;
|
| +
|
| + // Cancel's WaitForDataReady callback. |callback| passed in WaitForDataReady
|
| + // will not be called.
|
| + virtual void CancelWaitForDataReadyCallback() = 0;
|
| +
|
| + // Returns true if data is loaded from disk cache and ready (WaitForDataReady
|
| + // doesn't have a pending callback).
|
| + virtual bool IsDataReady() = 0;
|
| +
|
| + // Returns true if the object is ready to persist data, in other words, if
|
| + // data is loaded from disk cache and ready and there are no pending writes.
|
| + virtual bool IsReadyToPersist() = 0;
|
| +
|
| + // Persist allows for the server information to be updated for future users.
|
| + // This is a fire and forget operation: the caller may drop its reference
|
| + // from this object and the store operation will still complete. This can
|
| + // only be called once WaitForDataReady has returned OK or called its
|
| + // callback.
|
| virtual void Persist() = 0;
|
| +
|
| + // Called whenever an external cache reuses quic server config.
|
| + virtual void OnExternalCacheHit() = 0;
|
|
|
| // Returns the size of dynamically allocated memory in bytes.
|
| virtual size_t EstimateMemoryUsage() const = 0;
|
| @@ -79,6 +129,14 @@
|
| const State& state() const;
|
| State* mutable_state();
|
|
|
| + base::TimeTicks wait_for_data_start_time() const {
|
| + return wait_for_data_start_time_;
|
| + }
|
| +
|
| + base::TimeTicks wait_for_data_end_time() const {
|
| + return wait_for_data_end_time_;
|
| + }
|
| +
|
| protected:
|
| // Parse parses pickled data and fills out the public member fields of this
|
| // object. It returns true iff the parse was successful. The public member
|
| @@ -87,6 +145,10 @@
|
| std::string Serialize();
|
|
|
| State state_;
|
| +
|
| + // Time when WaitForDataReady was called and when it has finished.
|
| + base::TimeTicks wait_for_data_start_time_;
|
| + base::TimeTicks wait_for_data_end_time_;
|
|
|
| // This is the QUIC server (hostname, port, is_https, privacy_mode) tuple for
|
| // which we restore the crypto_config.
|
| @@ -102,6 +164,20 @@
|
| DISALLOW_COPY_AND_ASSIGN(QuicServerInfo);
|
| };
|
|
|
| +class QUIC_EXPORT_PRIVATE QuicServerInfoFactory {
|
| + public:
|
| + QuicServerInfoFactory() {}
|
| + virtual ~QuicServerInfoFactory();
|
| +
|
| + // GetForServer returns a fresh, allocated QuicServerInfo for the given
|
| + // |server_id| or NULL on failure.
|
| + virtual std::unique_ptr<QuicServerInfo> GetForServer(
|
| + const QuicServerId& server_id) = 0;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(QuicServerInfoFactory);
|
| +};
|
| +
|
| } // namespace net
|
|
|
| #endif // NET_QUIC_CHROMIUM_QUIC_SERVER_INFO_H_
|
|
|