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

Unified Diff: chrome/browser/net/transport_security_persister.h

Issue 57993004: Remove content dependency from TransportSecurityPersister. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/net/transport_security_persister.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/transport_security_persister.h
diff --git a/chrome/browser/net/transport_security_persister.h b/chrome/browser/net/transport_security_persister.h
index 644082d4730e5ef44ec8266cd9243f1649adfb63..0326fec5fb5b4cab882556e5f5e4f01a9aac5f84 100644
--- a/chrome/browser/net/transport_security_persister.h
+++ b/chrome/browser/net/transport_security_persister.h
@@ -13,7 +13,7 @@
// This means that it's possible for pages opened very quickly not to get the
// correct transport security information.
//
-// To load the state, we schedule a Task on the file thread which loads,
+// To load the state, we schedule a Task on file_task_runner, which
// deserializes and configures the TransportSecurityState.
//
// The TransportSecurityState object supports running a callback function
@@ -22,7 +22,7 @@
// TransportSecurityState calls...
// TransportSecurityPersister::StateIsDirty
// since the callback isn't allowed to block or reenter, we schedule a Task
-// on the file thread after some small amount of time
+// on the file task runner after some small amount of time
//
// ...
//
@@ -37,17 +37,26 @@
#include "base/files/file_path.h"
#include "base/files/important_file_writer.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "net/http/transport_security_state.h"
-// Reads and updates on-disk TransportSecurity state.
-// Must be created, used and destroyed only on the IO thread.
+namespace base {
+class SequencedTaskRunner;
+}
+
+// Reads and updates on-disk TransportSecurity state. Clients of this class
+// should create, destroy, and call into it from one thread.
+//
+// file_task_runner is the task runner this class should use internally to
+// perform file IO, and can optionally be associated with a different thread.
class TransportSecurityPersister
: public net::TransportSecurityState::Delegate,
public base::ImportantFileWriter::DataSerializer {
public:
TransportSecurityPersister(net::TransportSecurityState* state,
const base::FilePath& profile_path,
+ base::SequencedTaskRunner* file_task_runner,
bool readonly);
virtual ~TransportSecurityPersister();
@@ -94,8 +103,6 @@ class TransportSecurityPersister
bool LoadEntries(const std::string& serialized, bool* dirty);
private:
- class Loader;
-
// Populates |state| from the JSON string |serialized|. Returns true if
// all entries were parsed and deserialized correctly.
//
@@ -112,6 +119,9 @@ class TransportSecurityPersister
// Helper for safely writing the data.
base::ImportantFileWriter writer_;
+ scoped_refptr<base::SequencedTaskRunner> foreground_runner_;
+ scoped_refptr<base::SequencedTaskRunner> background_runner_;
+
// Whether or not we're in read-only mode.
const bool readonly_;
« no previous file with comments | « no previous file | chrome/browser/net/transport_security_persister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698