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

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

Issue 511163002: Net-related fixups for scoped_refptr conversion operator cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix naming to match Created 6 years, 3 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/disk_cache/simple/simple_index.cc ('k') | net/http/transport_security_persister.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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 // TransportSecurityState maintains an in memory database containing the 5 // TransportSecurityState maintains an in memory database containing the
6 // list of hosts that currently have transport security enabled. This 6 // list of hosts that currently have transport security enabled. This
7 // singleton object deals with writing that data out to disk as needed and 7 // singleton object deals with writing that data out to disk as needed and
8 // loading it at startup. 8 // loading it at startup.
9 9
10 // At startup we need to load the transport security state from the 10 // At startup we need to load the transport security state from the
11 // disk. For the moment, we don't want to delay startup for this load, so we 11 // disk. For the moment, we don't want to delay startup for this load, so we
12 // let the TransportSecurityState run for a while without being loaded. 12 // let the TransportSecurityState run for a while without being loaded.
13 // This means that it's possible for pages opened very quickly not to get the 13 // This means that it's possible for pages opened very quickly not to get the
14 // correct transport security information. 14 // correct transport security information.
15 // 15 //
16 // To load the state, we schedule a Task on file_task_runner, which 16 // To load the state, we schedule a Task on background_runner, which
17 // deserializes and configures the TransportSecurityState. 17 // deserializes and configures the TransportSecurityState.
18 // 18 //
19 // The TransportSecurityState object supports running a callback function 19 // The TransportSecurityState object supports running a callback function
20 // when it changes. This object registers the callback, pointing at itself. 20 // when it changes. This object registers the callback, pointing at itself.
21 // 21 //
22 // TransportSecurityState calls... 22 // TransportSecurityState calls...
23 // TransportSecurityPersister::StateIsDirty 23 // TransportSecurityPersister::StateIsDirty
24 // since the callback isn't allowed to block or reenter, we schedule a Task 24 // since the callback isn't allowed to block or reenter, we schedule a Task
25 // on the file task runner after some small amount of time 25 // on the file task runner after some small amount of time
26 // 26 //
(...skipping 17 matching lines...) Expand all
44 44
45 namespace base { 45 namespace base {
46 class SequencedTaskRunner; 46 class SequencedTaskRunner;
47 } 47 }
48 48
49 namespace net { 49 namespace net {
50 50
51 // Reads and updates on-disk TransportSecurity state. Clients of this class 51 // Reads and updates on-disk TransportSecurity state. Clients of this class
52 // should create, destroy, and call into it from one thread. 52 // should create, destroy, and call into it from one thread.
53 // 53 //
54 // file_task_runner is the task runner this class should use internally to 54 // background_runner is the task runner this class should use internally to
55 // perform file IO, and can optionally be associated with a different thread. 55 // perform file IO, and can optionally be associated with a different thread.
56 class NET_EXPORT TransportSecurityPersister 56 class NET_EXPORT TransportSecurityPersister
57 : public TransportSecurityState::Delegate, 57 : public TransportSecurityState::Delegate,
58 public base::ImportantFileWriter::DataSerializer { 58 public base::ImportantFileWriter::DataSerializer {
59 public: 59 public:
60 TransportSecurityPersister(TransportSecurityState* state, 60 TransportSecurityPersister(
61 const base::FilePath& profile_path, 61 TransportSecurityState* state,
62 base::SequencedTaskRunner* file_task_runner, 62 const base::FilePath& profile_path,
63 bool readonly); 63 const scoped_refptr<base::SequencedTaskRunner>& background_runner,
64 bool readonly);
64 virtual ~TransportSecurityPersister(); 65 virtual ~TransportSecurityPersister();
65 66
66 // Called by the TransportSecurityState when it changes its state. 67 // Called by the TransportSecurityState when it changes its state.
67 virtual void StateIsDirty(TransportSecurityState*) OVERRIDE; 68 virtual void StateIsDirty(TransportSecurityState*) OVERRIDE;
68 69
69 // ImportantFileWriter::DataSerializer: 70 // ImportantFileWriter::DataSerializer:
70 // 71 //
71 // Serializes |transport_security_state_| into |*output|. Returns true if 72 // Serializes |transport_security_state_| into |*output|. Returns true if
72 // all DomainStates were serialized correctly. 73 // all DomainStates were serialized correctly.
73 // 74 //
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const bool readonly_; 130 const bool readonly_;
130 131
131 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_; 132 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_;
132 133
133 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister); 134 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister);
134 }; 135 };
135 136
136 } // namespace net 137 } // namespace net
137 138
138 #endif // NET_HTTP_TRANSPORT_SECURITY_PERSISTER_H_ 139 #endif // NET_HTTP_TRANSPORT_SECURITY_PERSISTER_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index.cc ('k') | net/http/transport_security_persister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698