diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-21 18:54:32 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-21 18:54:32 +0000 |
commit | 02896a8fd669ced03e8a76edfbb423c858eafc53 (patch) | |
tree | c75f30c0004063e6e0c9db8109638131c099f7fe /chrome/browser/transport_security_persister.h | |
parent | 111efaf9b1799bcf2326703c2d26bd60f799ab2f (diff) | |
download | chromium_src-02896a8fd669ced03e8a76edfbb423c858eafc53.zip chromium_src-02896a8fd669ced03e8a76edfbb423c858eafc53.tar.gz chromium_src-02896a8fd669ced03e8a76edfbb423c858eafc53.tar.bz2 |
Move TransportSecurityPersister completely to IO thread.
This should fix problems caused by calling ImportantFileWriter
on wrong threads.
BUG=none
Review URL: http://codereview.chromium.org/7966005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/transport_security_persister.h')
-rw-r--r-- | chrome/browser/transport_security_persister.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/chrome/browser/transport_security_persister.h b/chrome/browser/transport_security_persister.h index 96bde66..7b56d469 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); }; |