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

Side by Side Diff: base/prefs/json_pref_store.cc

Issue 836093005: Remove dead code related to base::JsonPrefStore without a path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Less code is better (removed instead of fixed). Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/prefs/json_pref_store.h" 5 #include "base/prefs/json_pref_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 251
252 PersistentPrefStore::PrefReadError JsonPrefStore::GetReadError() const { 252 PersistentPrefStore::PrefReadError JsonPrefStore::GetReadError() const {
253 DCHECK(CalledOnValidThread()); 253 DCHECK(CalledOnValidThread());
254 254
255 return read_error_; 255 return read_error_;
256 } 256 }
257 257
258 PersistentPrefStore::PrefReadError JsonPrefStore::ReadPrefs() { 258 PersistentPrefStore::PrefReadError JsonPrefStore::ReadPrefs() {
259 DCHECK(CalledOnValidThread()); 259 DCHECK(CalledOnValidThread());
260 260 DCHECK(!path_.empty());
Bernhard Bauer 2015/01/07 11:01:03 Can we do this check at construction time?
Daniel Bratell 2015/01/07 13:44:34 Done.
261 if (path_.empty()) {
262 scoped_ptr<ReadResult> no_file_result;
263 no_file_result->error = PREF_READ_ERROR_FILE_NOT_SPECIFIED;
264 OnFileRead(no_file_result.Pass());
265 return PREF_READ_ERROR_FILE_NOT_SPECIFIED;
266 }
267 261
268 OnFileRead(ReadPrefsFromDisk(path_, alternate_path_)); 262 OnFileRead(ReadPrefsFromDisk(path_, alternate_path_));
269 return filtering_in_progress_ ? PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE 263 return filtering_in_progress_ ? PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE
270 : read_error_; 264 : read_error_;
271 } 265 }
272 266
273 void JsonPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) { 267 void JsonPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) {
274 DCHECK(CalledOnValidThread()); 268 DCHECK(CalledOnValidThread());
269 DCHECK(!path_.empty());
275 270
276 initialized_ = false; 271 initialized_ = false;
277 error_delegate_.reset(error_delegate); 272 error_delegate_.reset(error_delegate);
278 if (path_.empty()) {
279 scoped_ptr<ReadResult> no_file_result;
280 no_file_result->error = PREF_READ_ERROR_FILE_NOT_SPECIFIED;
281 OnFileRead(no_file_result.Pass());
282 return;
283 }
284 273
285 // Weakly binds the read task so that it doesn't kick in during shutdown. 274 // Weakly binds the read task so that it doesn't kick in during shutdown.
286 base::PostTaskAndReplyWithResult( 275 base::PostTaskAndReplyWithResult(
287 sequenced_task_runner_.get(), 276 sequenced_task_runner_.get(),
288 FROM_HERE, 277 FROM_HERE,
289 base::Bind(&ReadPrefsFromDisk, path_, alternate_path_), 278 base::Bind(&ReadPrefsFromDisk, path_, alternate_path_),
290 base::Bind(&JsonPrefStore::OnFileRead, AsWeakPtr())); 279 base::Bind(&JsonPrefStore::OnFileRead, AsWeakPtr()));
291 } 280 }
292 281
293 void JsonPrefStore::CommitPendingWrite() { 282 void JsonPrefStore::CommitPendingWrite() {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 425
437 if (error_delegate_ && read_error_ != PREF_READ_ERROR_NONE) 426 if (error_delegate_ && read_error_ != PREF_READ_ERROR_NONE)
438 error_delegate_->OnError(read_error_); 427 error_delegate_->OnError(read_error_);
439 428
440 FOR_EACH_OBSERVER(PrefStore::Observer, 429 FOR_EACH_OBSERVER(PrefStore::Observer,
441 observers_, 430 observers_,
442 OnInitializationCompleted(true)); 431 OnInitializationCompleted(true));
443 432
444 return; 433 return;
445 } 434 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698