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

Unified Diff: chrome/browser/transport_security_persister.h

Issue 7966005: Move TransportSecurityPersister completely to IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/transport_security_persister.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/transport_security_persister.h
diff --git a/chrome/browser/transport_security_persister.h b/chrome/browser/transport_security_persister.h
index 96bde66f1e135a7adfb69bb24492ee48781f370b..7b56d469cb0a8ce488a21e83b8c4210822e6d488 100644
--- a/chrome/browser/transport_security_persister.h
+++ b/chrome/browser/transport_security_persister.h
@@ -37,24 +37,20 @@
#include <string>
#include "base/file_path.h"
-#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "chrome/common/important_file_writer.h"
-#include "content/browser/browser_thread.h"
#include "net/base/transport_security_state.h"
+// Reads and updates on-disk TransportSecurity state.
+// Must be created, used and destroyed only on the IO thread.
class TransportSecurityPersister
- : public base::RefCountedThreadSafe<TransportSecurityPersister,
- BrowserThread::DeleteOnUIThread>,
- public net::TransportSecurityState::Delegate,
+ : public net::TransportSecurityState::Delegate,
public ImportantFileWriter::DataSerializer {
public:
TransportSecurityPersister(net::TransportSecurityState* state,
const FilePath& profile_path,
bool readonly);
-
- // Starts transport security data load on a background thread.
- // Must be called on the UI thread right after construction.
- void Init();
+ virtual ~TransportSecurityPersister();
// Called by the TransportSecurityState when it changes its state.
virtual void StateIsDirty(net::TransportSecurityState*);
@@ -63,15 +59,10 @@ class TransportSecurityPersister
virtual bool SerializeData(std::string* data);
private:
- friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
- friend class DeleteTask<TransportSecurityPersister>;
+ class Loader;
- virtual ~TransportSecurityPersister();
-
- void Load();
void CompleteLoad(const std::string& state);
- // IO thread only.
scoped_refptr<net::TransportSecurityState> transport_security_state_;
// Helper for safely writing the data.
@@ -80,6 +71,8 @@ class TransportSecurityPersister
// Whether or not we're in read-only mode.
const bool readonly_;
+ base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister);
};
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/transport_security_persister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698