| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/disk_cache/disk_cache.h" | 14 #include "net/disk_cache/disk_cache.h" |
| 15 #include "net/quic/crypto/quic_server_info.h" | 15 #include "net/quic/crypto/quic_server_info.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class HttpCache; | 19 class HttpCache; |
| 20 class IOBuffer; | 20 class IOBuffer; |
| 21 class QuicSessionKey; | 21 class QuicServerId; |
| 22 | 22 |
| 23 // DiskCacheBasedQuicServerInfo fetches information about a QUIC server from | 23 // DiskCacheBasedQuicServerInfo fetches information about a QUIC server from |
| 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 QuicSessionKey& server_key, | 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 virtual void Start() OVERRIDE; |
| 35 virtual int WaitForDataReady(const CompletionCallback& callback) OVERRIDE; | 35 virtual int WaitForDataReady(const CompletionCallback& callback) OVERRIDE; |
| 36 virtual bool IsDataReady() OVERRIDE; | 36 virtual bool IsDataReady() OVERRIDE; |
| 37 virtual bool IsReadyToPersist() OVERRIDE; | 37 virtual bool IsReadyToPersist() OVERRIDE; |
| 38 virtual void Persist() OVERRIDE; | 38 virtual void Persist() OVERRIDE; |
| 39 | 39 |
| 40 private: | 40 private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // DoSetDone is the terminal state of the write operation. | 84 // DoSetDone is the terminal state of the write operation. |
| 85 int DoSetDone(); | 85 int DoSetDone(); |
| 86 | 86 |
| 87 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; | 87 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; |
| 88 CacheOperationDataShim* data_shim_; // Owned by |io_callback_|. | 88 CacheOperationDataShim* data_shim_; // Owned by |io_callback_|. |
| 89 CompletionCallback io_callback_; | 89 CompletionCallback io_callback_; |
| 90 State state_; | 90 State state_; |
| 91 bool ready_; | 91 bool ready_; |
| 92 bool found_entry_; // Controls the behavior of DoCreateOrOpen. | 92 bool found_entry_; // Controls the behavior of DoCreateOrOpen. |
| 93 std::string new_data_; | 93 std::string new_data_; |
| 94 const QuicSessionKey server_key_; | 94 const QuicServerId server_id_; |
| 95 HttpCache* const http_cache_; | 95 HttpCache* const http_cache_; |
| 96 disk_cache::Backend* backend_; | 96 disk_cache::Backend* backend_; |
| 97 disk_cache::Entry* entry_; | 97 disk_cache::Entry* entry_; |
| 98 CompletionCallback user_callback_; | 98 CompletionCallback user_callback_; |
| 99 scoped_refptr<IOBuffer> read_buffer_; | 99 scoped_refptr<IOBuffer> read_buffer_; |
| 100 scoped_refptr<IOBuffer> write_buffer_; | 100 scoped_refptr<IOBuffer> write_buffer_; |
| 101 std::string data_; | 101 std::string data_; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace net | 104 } // namespace net |
| 105 | 105 |
| 106 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ | 106 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ |
| OLD | NEW |