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

Unified Diff: net/http/transport_security_persister.cc

Issue 1127963002: Implement lossy pref behavior for JsonPrefStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs-fix-flags
Patch Set: Created 5 years, 7 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: net/http/transport_security_persister.cc
diff --git a/net/http/transport_security_persister.cc b/net/http/transport_security_persister.cc
index 08aa07e1c9112ae1d8046dfb59f3303d4240aea9..bc2d6697e4bcfefde2cae36e48bb7dd1a7a8fef9 100644
--- a/net/http/transport_security_persister.cc
+++ b/net/http/transport_security_persister.cc
@@ -94,7 +94,9 @@ TransportSecurityPersister::TransportSecurityPersister(
const scoped_refptr<base::SequencedTaskRunner>& background_runner,
bool readonly)
: transport_security_state_(state),
- writer_(profile_path.AppendASCII("TransportSecurity"), background_runner),
+ writer_(new base::ImportantFileWriterImpl(
+ profile_path.AppendASCII("TransportSecurity"),
+ background_runner)),
foreground_runner_(base::MessageLoop::current()->message_loop_proxy()),
background_runner_(background_runner),
readonly_(readonly),
@@ -103,7 +105,7 @@ TransportSecurityPersister::TransportSecurityPersister(
base::PostTaskAndReplyWithResult(
background_runner_.get(), FROM_HERE,
- base::Bind(&LoadState, writer_.path()),
+ base::Bind(&LoadState, writer_->path()),
base::Bind(&TransportSecurityPersister::CompleteLoad,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -111,8 +113,8 @@ TransportSecurityPersister::TransportSecurityPersister(
TransportSecurityPersister::~TransportSecurityPersister() {
DCHECK(foreground_runner_->RunsTasksOnCurrentThread());
- if (writer_.HasPendingWrite())
- writer_.DoScheduledWrite();
+ if (writer_->HasPendingWrite())
+ writer_->DoScheduledWrite();
transport_security_state_->SetDelegate(NULL);
}
@@ -123,7 +125,7 @@ void TransportSecurityPersister::StateIsDirty(
DCHECK_EQ(transport_security_state_, state);
if (!readonly_)
- writer_.ScheduleWrite(this);
+ writer_->ScheduleWrite(this);
}
bool TransportSecurityPersister::SerializeData(std::string* output) {

Powered by Google App Engine
This is Rietveld 408576698