summaryrefslogtreecommitdiffstats
path: root/chrome/browser/strict_transport_security_persister.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 05:59:37 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 05:59:37 +0000
commit6fad26338ed6119903826156f307e20fe6657c31 (patch)
tree5c6baed35fce907a0cea47ed6091c941db8ebfd1 /chrome/browser/strict_transport_security_persister.cc
parentf75c8f13b967b01babc9454506e9d2ed00519e39 (diff)
downloadchromium_src-6fad26338ed6119903826156f307e20fe6657c31.zip
chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.gz
chromium_src-6fad26338ed6119903826156f307e20fe6657c31.tar.bz2
Third patch in getting rid of caching MessageLoop pointers and always using ChromeThread instead.
BUG=25354 Review URL: http://codereview.chromium.org/342068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/strict_transport_security_persister.cc')
-rw-r--r--chrome/browser/strict_transport_security_persister.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/chrome/browser/strict_transport_security_persister.cc b/chrome/browser/strict_transport_security_persister.cc
index 310cf23..52fc611 100644
--- a/chrome/browser/strict_transport_security_persister.cc
+++ b/chrome/browser/strict_transport_security_persister.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,25 +8,22 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/thread.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_paths.h"
#include "net/base/strict_transport_security_state.h"
StrictTransportSecurityPersister::StrictTransportSecurityPersister(
net::StrictTransportSecurityState* state,
- base::Thread* file_thread,
const FilePath& profile_path)
: state_is_dirty_(false),
strict_transport_security_state_(state),
- file_thread_(file_thread),
state_file_(profile_path.Append(
FILE_PATH_LITERAL("StrictTransportSecurity"))) {
state->SetDelegate(this);
Task* task = NewRunnableMethod(this,
&StrictTransportSecurityPersister::LoadState);
- file_thread->message_loop()->PostDelayedTask(FROM_HERE, task,
- 1000 /* 1 second */);
+ ChromeThread::PostDelayedTask(ChromeThread::FILE, FROM_HERE, task, 1000);
}
StrictTransportSecurityPersister::~StrictTransportSecurityPersister() {
@@ -34,9 +31,8 @@ StrictTransportSecurityPersister::~StrictTransportSecurityPersister() {
}
void StrictTransportSecurityPersister::LoadState() {
- // Runs on |file_thread_|
AutoLock locked_(lock_);
- DCHECK(file_thread_->message_loop() == MessageLoop::current());
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
std::string state;
if (!file_util::ReadFileToString(state_file_, &state))
@@ -57,15 +53,13 @@ void StrictTransportSecurityPersister::StateIsDirty(
Task* task = NewRunnableMethod(this,
&StrictTransportSecurityPersister::SerialiseState);
- file_thread_->message_loop()->PostDelayedTask(FROM_HERE, task,
- 1000 /* 1 second */);
+ ChromeThread::PostDelayedTask(ChromeThread::FILE, FROM_HERE, task, 1000);
state_is_dirty_ = true;
}
void StrictTransportSecurityPersister::SerialiseState() {
- // Runs on |file_thread_|
AutoLock locked_(lock_);
- DCHECK(file_thread_->message_loop() == MessageLoop::current());
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
DCHECK(state_is_dirty_);
state_is_dirty_ = false;