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

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

Issue 135373002: Added SSLHostInfo. Storing of server host info to our standard disk cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed wtc's comments Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_
6 #define NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "net/base/completion_callback.h"
14 #include "net/disk_cache/disk_cache.h"
15 #include "net/socket/ssl_host_info.h"
16
17 namespace net {
18
19 class HttpCache;
20 class IOBuffer;
21 struct SSLConfig;
22
23 // DiskCacheBasedSSLHostInfo fetches information about an SSL host from our
24 // standard disk cache. Since the information is defined to be non-sensitive,
25 // it's ok for us to keep it on disk.
26 class NET_EXPORT_PRIVATE DiskCacheBasedSSLHostInfo
27 : public SSLHostInfo,
28 public NON_EXPORTED_BASE(base::NonThreadSafe) {
29 public:
30 DiskCacheBasedSSLHostInfo(const std::string& hostname,
31 const SSLConfig& ssl_config,
32 CertVerifier* cert_verifier,
33 HttpCache* http_cache);
34
35 // SSLHostInfo implementation.
36 virtual void Start() OVERRIDE;
37 virtual int WaitForDataReady(const CompletionCallback& callback) OVERRIDE;
38 virtual void Persist() OVERRIDE;
39
40 private:
41 struct CacheOperationDataShim;
42 enum State {
43 GET_BACKEND,
44 GET_BACKEND_COMPLETE,
45 OPEN,
46 OPEN_COMPLETE,
47 READ,
48 READ_COMPLETE,
49 WAIT_FOR_DATA_READY_DONE,
50 CREATE_OR_OPEN,
51 CREATE_OR_OPEN_COMPLETE,
52 WRITE,
53 WRITE_COMPLETE,
54 SET_DONE,
55 NONE,
56 };
57
58 virtual ~DiskCacheBasedSSLHostInfo();
59
60 std::string key() const;
61
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
64 // this method. See comment above CacheOperationDataShim for details.
65 void OnIOComplete(CacheOperationDataShim* unused, int rv);
66
67 int DoLoop(int rv);
68
69 int DoGetBackendComplete(int rv);
70 int DoOpenComplete(int rv);
71 int DoReadComplete(int rv);
72 int DoWriteComplete(int rv);
73 int DoCreateOrOpenComplete(int rv);
74
75 int DoGetBackend();
76 int DoOpen();
77 int DoRead();
78 int DoWrite();
79 int DoCreateOrOpen();
80
81 // DoWaitForDataReadyDone is the terminal state of the read operation.
82 int DoWaitForDataReadyDone();
83
84 // DoSetDone is the terminal state of the write operation.
85 int DoSetDone();
86
87 base::WeakPtrFactory<DiskCacheBasedSSLHostInfo> weak_factory_;
88 CacheOperationDataShim* data_shim_; // Owned by |io_callback_|.
89 CompletionCallback io_callback_;
90 State state_;
91 bool ready_;
92 bool found_entry_; // Controls the behavior of DoCreateOrOpen.
93 std::string new_data_;
94 const std::string hostname_;
95 HttpCache* const http_cache_;
96 disk_cache::Backend* backend_;
97 disk_cache::Entry* entry_;
98 CompletionCallback user_callback_;
99 scoped_refptr<IOBuffer> read_buffer_;
100 scoped_refptr<IOBuffer> write_buffer_;
101 std::string data_;
102 };
103
104 } // namespace net
105
106 #endif // NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/disk_cache_based_ssl_host_info.cc » ('j') | net/http/http_cache_transaction.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698