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

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

Issue 2807493002: Track STL containers in QuicStreamFactory::DumpMemoryStats (Closed)
Patch Set: address zhongyi@ comment Created 3 years, 8 months 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 | « net/BUILD.gn ('k') | 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/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
16 #include "net/base/net_export.h" 16 #include "net/base/net_export.h"
17 #include "net/disk_cache/disk_cache.h" 17 #include "net/disk_cache/disk_cache.h"
18 #include "net/quic/chromium/quic_server_info.h" 18 #include "net/quic/chromium/quic_server_info.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 class HttpCache; 22 class HttpCache;
23 class IOBuffer; 23 class IOBufferWithSize;
24 class QuicServerId; 24 class QuicServerId;
25 25
26 // DiskCacheBasedQuicServerInfo fetches information about a QUIC server from 26 // DiskCacheBasedQuicServerInfo fetches information about a QUIC server from
27 // our standard disk cache. Since the information is defined to be 27 // our standard disk cache. Since the information is defined to be
28 // non-sensitive, it's ok for us to keep it on disk. 28 // non-sensitive, it's ok for us to keep it on disk.
29 class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo 29 class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
30 : public QuicServerInfo, 30 : public QuicServerInfo,
31 public NON_EXPORTED_BASE(base::NonThreadSafe) { 31 public NON_EXPORTED_BASE(base::NonThreadSafe) {
32 public: 32 public:
33 DiskCacheBasedQuicServerInfo(const QuicServerId& server_id, 33 DiskCacheBasedQuicServerInfo(const QuicServerId& server_id,
34 HttpCache* http_cache); 34 HttpCache* http_cache);
35 ~DiskCacheBasedQuicServerInfo() override; 35 ~DiskCacheBasedQuicServerInfo() override;
36 36
37 // QuicServerInfo implementation. 37 // QuicServerInfo implementation.
38 void Start() override; 38 void Start() override;
39 int WaitForDataReady(const CompletionCallback& callback) override; 39 int WaitForDataReady(const CompletionCallback& callback) override;
40 void ResetWaitForDataReadyCallback() override; 40 void ResetWaitForDataReadyCallback() override;
41 void CancelWaitForDataReadyCallback() override; 41 void CancelWaitForDataReadyCallback() override;
42 bool IsDataReady() override; 42 bool IsDataReady() override;
43 bool IsReadyToPersist() override; 43 bool IsReadyToPersist() override;
44 void Persist() override; 44 void Persist() override;
45 void OnExternalCacheHit() override; 45 void OnExternalCacheHit() override;
46 size_t EstimateMemoryUsage() const override;
46 47
47 private: 48 private:
48 struct CacheOperationDataShim; 49 struct CacheOperationDataShim;
49 50
50 enum State { 51 enum State {
51 GET_BACKEND, 52 GET_BACKEND,
52 GET_BACKEND_COMPLETE, 53 GET_BACKEND_COMPLETE,
53 OPEN, 54 OPEN,
54 OPEN_COMPLETE, 55 OPEN_COMPLETE,
55 READ, 56 READ,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 State state_; 112 State state_;
112 bool ready_; 113 bool ready_;
113 bool found_entry_; // Controls the behavior of DoCreateOrOpen. 114 bool found_entry_; // Controls the behavior of DoCreateOrOpen.
114 std::string new_data_; 115 std::string new_data_;
115 std::string pending_write_data_; 116 std::string pending_write_data_;
116 const QuicServerId server_id_; 117 const QuicServerId server_id_;
117 HttpCache* const http_cache_; 118 HttpCache* const http_cache_;
118 disk_cache::Backend* backend_; 119 disk_cache::Backend* backend_;
119 disk_cache::Entry* entry_; 120 disk_cache::Entry* entry_;
120 CompletionCallback wait_for_ready_callback_; 121 CompletionCallback wait_for_ready_callback_;
121 scoped_refptr<IOBuffer> read_buffer_; 122 scoped_refptr<IOBufferWithSize> read_buffer_;
122 scoped_refptr<IOBuffer> write_buffer_; 123 scoped_refptr<IOBufferWithSize> write_buffer_;
123 std::string data_; 124 std::string data_;
124 base::TimeTicks load_start_time_; 125 base::TimeTicks load_start_time_;
125 FailureReason last_failure_; 126 FailureReason last_failure_;
126 127
127 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_; 128 base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_;
128 129
129 DISALLOW_COPY_AND_ASSIGN(DiskCacheBasedQuicServerInfo); 130 DISALLOW_COPY_AND_ASSIGN(DiskCacheBasedQuicServerInfo);
130 }; 131 };
131 132
132 } // namespace net 133 } // namespace net
133 134
134 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_ 135 #endif // NET_HTTP_DISK_CACHE_BASED_QUIC_SERVER_INFO_H_
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/http/disk_cache_based_quic_server_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698