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

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
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..a3065ba0a5682a77dfaf12331e3c0450a623b73b 100644
--- a/chrome/browser/transport_security_persister.h
+++ b/chrome/browser/transport_security_persister.h
@@ -37,24 +37,21 @@
#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 ImportantFileWriter::DataSerializer {
+ : public net::TransportSecurityState::Delegate,
+ public ImportantFileWriter::DataSerializer,
+ public base::SupportsWeakPtr<TransportSecurityPersister> {
willchan no longer on Chromium 2011/09/20 19:09:04 Can you use base::WeakPtrFactory as a private memb
Paweł Hajdan Jr. 2011/09/21 17:59:19 Good idea, done.
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 +60,10 @@ class TransportSecurityPersister
virtual bool SerializeData(std::string* data);
private:
- friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
- friend class DeleteTask<TransportSecurityPersister>;
-
- virtual ~TransportSecurityPersister();
+ class Loader;
- void Load();
void CompleteLoad(const std::string& state);
- // IO thread only.
scoped_refptr<net::TransportSecurityState> transport_security_state_;
// Helper for safely writing the data.

Powered by Google App Engine
This is Rietveld 408576698