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

Unified Diff: chrome/browser/strict_transport_security_persister.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/strict_transport_security_persister.cc
===================================================================
--- chrome/browser/strict_transport_security_persister.cc (revision 30650)
+++ chrome/browser/strict_transport_security_persister.cc (working copy)
@@ -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 @@
}
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 @@
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;
« no previous file with comments | « chrome/browser/strict_transport_security_persister.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698