| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |