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

Side by Side Diff: chrome/browser/prefs/leveldb_pref_store.cc

Issue 1148323005: Add the ability to schedule any pending lossy prefs to be written. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/leveldb_pref_store.h" 5 #include "chrome/browser/prefs/leveldb_pref_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 weak_ptr_factory_.GetWeakPtr())); 349 weak_ptr_factory_.GetWeakPtr()));
350 } 350 }
351 351
352 void LevelDBPrefStore::CommitPendingWrite() { 352 void LevelDBPrefStore::CommitPendingWrite() {
353 if (timer_.IsRunning()) { 353 if (timer_.IsRunning()) {
354 timer_.Stop(); 354 timer_.Stop();
355 PersistFromUIThread(); 355 PersistFromUIThread();
356 } 356 }
357 } 357 }
358 358
359 void LevelDBPrefStore::SchedulePendingLossyWrites() {
360 // LevelDBPrefStore does not support lossy prefs.
361 }
362
359 void LevelDBPrefStore::MarkForDeletion(const std::string& key) { 363 void LevelDBPrefStore::MarkForDeletion(const std::string& key) {
360 if (read_only_) 364 if (read_only_)
361 return; 365 return;
362 keys_to_delete_.insert(key); 366 keys_to_delete_.insert(key);
363 // Need to erase in case there's a set operation in the same batch that would 367 // Need to erase in case there's a set operation in the same batch that would
364 // clobber this delete. 368 // clobber this delete.
365 keys_to_set_.erase(key); 369 keys_to_set_.erase(key);
366 ScheduleWrite(); 370 ScheduleWrite();
367 } 371 }
368 372
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 418 }
415 419
416 // TODO(dgrogan): Call pref_filter_->FilterOnLoad 420 // TODO(dgrogan): Call pref_filter_->FilterOnLoad
417 421
418 if (error_delegate_.get() && read_error_ != PREF_READ_ERROR_NONE) 422 if (error_delegate_.get() && read_error_ != PREF_READ_ERROR_NONE)
419 error_delegate_->OnError(read_error_); 423 error_delegate_->OnError(read_error_);
420 424
421 FOR_EACH_OBSERVER( 425 FOR_EACH_OBSERVER(
422 PrefStore::Observer, observers_, OnInitializationCompleted(true)); 426 PrefStore::Observer, observers_, OnInitializationCompleted(true));
423 } 427 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/leveldb_pref_store.h ('k') | chrome/browser/prefs/tracked/segregated_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698