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

Unified Diff: chrome/browser/strict_transport_security_persister.cc

Issue 399016: Fix race conditions where an object's constructor uses PostTask on itself. T... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
Index: chrome/browser/strict_transport_security_persister.cc
===================================================================
--- chrome/browser/strict_transport_security_persister.cc (revision 32148)
+++ chrome/browser/strict_transport_security_persister.cc (working copy)
@@ -12,13 +12,19 @@
#include "chrome/common/chrome_paths.h"
#include "net/base/strict_transport_security_state.h"
-StrictTransportSecurityPersister::StrictTransportSecurityPersister(
- net::StrictTransportSecurityState* state,
- const FilePath& profile_path)
- : state_is_dirty_(false),
- strict_transport_security_state_(state),
- state_file_(profile_path.Append(
- FILE_PATH_LITERAL("StrictTransportSecurity"))) {
+StrictTransportSecurityPersister::StrictTransportSecurityPersister()
+ : state_is_dirty_(false) {
+}
+
+StrictTransportSecurityPersister::~StrictTransportSecurityPersister() {
+ strict_transport_security_state_->SetDelegate(NULL);
+}
+
+void StrictTransportSecurityPersister::Initialize(
+ net::StrictTransportSecurityState* state, const FilePath& profile_path) {
+ strict_transport_security_state_ = state;
+ state_file_ =
+ profile_path.Append(FILE_PATH_LITERAL("StrictTransportSecurity"));
state->SetDelegate(this);
Task* task = NewRunnableMethod(this,
@@ -26,10 +32,6 @@
ChromeThread::PostDelayedTask(ChromeThread::FILE, FROM_HERE, task, 1000);
}
-StrictTransportSecurityPersister::~StrictTransportSecurityPersister() {
- strict_transport_security_state_->SetDelegate(NULL);
-}
-
void StrictTransportSecurityPersister::LoadState() {
AutoLock locked_(lock_);
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));

Powered by Google App Engine
This is Rietveld 408576698