| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // our standard disk cache. Since the information is defined to be | 24 // our standard disk cache. Since the information is defined to be |
| 25 // non-sensitive, it's ok for us to keep it on disk. | 25 // non-sensitive, it's ok for us to keep it on disk. |
| 26 class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo | 26 class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo |
| 27 : public QuicServerInfo, | 27 : public QuicServerInfo, |
| 28 public NON_EXPORTED_BASE(base::NonThreadSafe) { | 28 public NON_EXPORTED_BASE(base::NonThreadSafe) { |
| 29 public: | 29 public: |
| 30 DiskCacheBasedQuicServerInfo(const QuicServerId& server_id, | 30 DiskCacheBasedQuicServerInfo(const QuicServerId& server_id, |
| 31 HttpCache* http_cache); | 31 HttpCache* http_cache); |
| 32 | 32 |
| 33 // QuicServerInfo implementation. | 33 // QuicServerInfo implementation. |
| 34 virtual void Start() override; | 34 void Start() override; |
| 35 virtual int WaitForDataReady(const CompletionCallback& callback) override; | 35 int WaitForDataReady(const CompletionCallback& callback) override; |
| 36 virtual bool IsDataReady() override; | 36 bool IsDataReady() override; |
| 37 virtual bool IsReadyToPersist() override; | 37 bool IsReadyToPersist() override; |
| 38 virtual void Persist() override; | 38 void Persist() override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 struct CacheOperationDataShim; | 41 struct CacheOperationDataShim; |
| 42 enum State { | 42 enum State { |
| 43 GET_BACKEND, | 43 GET_BACKEND, |
| 44 GET_BACKEND_COMPLETE, | 44 GET_BACKEND_COMPLETE, |
| 45 OPEN, | 45 OPEN, |
| 46 OPEN_COMPLETE, | 46 OPEN_COMPLETE, |
| 47 READ, | 47 READ, |
| 48 READ_COMPLETE, | 48 READ_COMPLETE, |
| 49 WAIT_FOR_DATA_READY_DONE, | 49 WAIT_FOR_DATA_READY_DONE, |
| 50 CREATE_OR_OPEN, | 50 CREATE_OR_OPEN, |
| 51 CREATE_OR_OPEN_COMPLETE, | 51 CREATE_OR_OPEN_COMPLETE, |
| 52 WRITE, | 52 WRITE, |
| 53 WRITE_COMPLETE, | 53 WRITE_COMPLETE, |
| 54 SET_DONE, | 54 SET_DONE, |
| 55 NONE, | 55 NONE, |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 virtual ~DiskCacheBasedQuicServerInfo(); | 58 ~DiskCacheBasedQuicServerInfo() override; |
| 59 | 59 |
| 60 std::string key() const; | 60 std::string key() const; |
| 61 | 61 |
| 62 // The |unused| parameter is a small hack so that we can have the | 62 // The |unused| parameter is a small hack so that we can have the |
| 63 // CacheOperationDataShim object owned by the Callback that is created for | 63 // CacheOperationDataShim object owned by the Callback that is created for |
| 64 // this method. See comment above CacheOperationDataShim for details. | 64 // this method. See comment above CacheOperationDataShim for details. |
| 65 void OnIOComplete(CacheOperationDataShim* unused, int rv); | 65 void OnIOComplete(CacheOperationDataShim* unused, int rv); |
| 66 | 66 |
| 67 int DoLoop(int rv); | 67 int DoLoop(int rv); |
| 68 | 68 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 98 scoped_refptr<IOBuffer> read_buffer_; | 98 scoped_refptr<IOBuffer> read_buffer_; |
| 99 scoped_refptr<IOBuffer> write_buffer_; | 99 scoped_refptr<IOBuffer> write_buffer_; |
| 100 std::string data_; | 100 std::string data_; |
| 101 | 101 |
| 102 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; | 102 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace net | 105 } // namespace net |
| 106 | 106 |
| 107 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ | 107 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ |
| OLD | NEW |