summaryrefslogtreecommitdiffstats
path: root/chrome/browser/transport_security_persister.h
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-19 18:20:14 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-19 18:20:14 +0000
commit9e0ce17c8308d897b7fadf7b1164c4c5234cfe98 (patch)
tree4ba7d50424efe1ebaffafd6ce92d9088c0a2c369 /chrome/browser/transport_security_persister.h
parent499f6a610abcf6a057cbb8324f90a07d89f59431 (diff)
downloadchromium_src-9e0ce17c8308d897b7fadf7b1164c4c5234cfe98.zip
chromium_src-9e0ce17c8308d897b7fadf7b1164c4c5234cfe98.tar.gz
chromium_src-9e0ce17c8308d897b7fadf7b1164c4c5234cfe98.tar.bz2
Revert r101377 and r100426.
These commits seem to be causing crashes due to thread issues. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/transport_security_persister.h')
-rw-r--r--chrome/browser/transport_security_persister.h45
1 files changed, 18 insertions, 27 deletions
diff --git a/chrome/browser/transport_security_persister.h b/chrome/browser/transport_security_persister.h
index 96bde66..de0d74d 100644
--- a/chrome/browser/transport_security_persister.h
+++ b/chrome/browser/transport_security_persister.h
@@ -34,53 +34,44 @@
#define CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_
#pragma once
-#include <string>
-
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
-#include "chrome/common/important_file_writer.h"
-#include "content/browser/browser_thread.h"
+#include "base/task.h"
#include "net/base/transport_security_state.h"
class TransportSecurityPersister
- : public base::RefCountedThreadSafe<TransportSecurityPersister,
- BrowserThread::DeleteOnUIThread>,
- public net::TransportSecurityState::Delegate,
- public ImportantFileWriter::DataSerializer {
+ : public base::RefCountedThreadSafe<TransportSecurityPersister>,
+ public net::TransportSecurityState::Delegate {
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();
+ explicit TransportSecurityPersister(bool readonly);
+ void Initialize(net::TransportSecurityState* state,
+ const FilePath& profile_path);
// Called by the TransportSecurityState when it changes its state.
virtual void StateIsDirty(net::TransportSecurityState*);
- // ImportantFileWriter::DataSerializer:
- virtual bool SerializeData(std::string* data);
-
private:
- friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
- friend class DeleteTask<TransportSecurityPersister>;
+ friend class base::RefCountedThreadSafe<TransportSecurityPersister>;
virtual ~TransportSecurityPersister();
void Load();
void CompleteLoad(const std::string& state);
- // IO thread only.
- scoped_refptr<net::TransportSecurityState> transport_security_state_;
+ void Save();
+ void CompleteSave(const std::string& state);
- // Helper for safely writing the data.
- ImportantFileWriter writer_;
+ // Used on the IO thread to coalesce writes to disk.
+ ScopedRunnableMethodFactory<TransportSecurityPersister> save_coalescer_;
- // Whether or not we're in read-only mode.
- const bool readonly_;
+ scoped_refptr<net::TransportSecurityState>
+ transport_security_state_; // IO thread only.
+
+ // The path to the file in which we store the serialised state.
+ FilePath state_file_;
- DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister);
+ // Whether or not we're in read-only mode.
+ bool readonly_;
};
#endif // CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_