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

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

Issue 226633002: Commit changes after a reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't commit, just schedule. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/prefs/pref_filter.h » ('j') | 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // If the file just doesn't exist, maybe this is first run. In any case 307 // If the file just doesn't exist, maybe this is first run. In any case
308 // there's no harm in writing out default prefs in this case. 308 // there's no harm in writing out default prefs in this case.
309 break; 309 break;
310 case PREF_READ_ERROR_JSON_PARSE: 310 case PREF_READ_ERROR_JSON_PARSE:
311 case PREF_READ_ERROR_JSON_REPEAT: 311 case PREF_READ_ERROR_JSON_REPEAT:
312 break; 312 break;
313 default: 313 default:
314 NOTREACHED() << "Unknown error: " << error; 314 NOTREACHED() << "Unknown error: " << error;
315 } 315 }
316 316
317 if (pref_filter_) 317 if (pref_filter_ && pref_filter_->FilterOnLoad(prefs_.get()))
318 pref_filter_->FilterOnLoad(prefs_.get()); 318 writer_.ScheduleWrite(this);
319 319
320 if (error_delegate_.get() && error != PREF_READ_ERROR_NONE) 320 if (error_delegate_.get() && error != PREF_READ_ERROR_NONE)
321 error_delegate_->OnError(error); 321 error_delegate_->OnError(error);
322 322
323 FOR_EACH_OBSERVER(PrefStore::Observer, 323 FOR_EACH_OBSERVER(PrefStore::Observer,
324 observers_, 324 observers_,
325 OnInitializationCompleted(true)); 325 OnInitializationCompleted(true));
326 } 326 }
327 327
328 JsonPrefStore::~JsonPrefStore() { 328 JsonPrefStore::~JsonPrefStore() {
329 CommitPendingWrite(); 329 CommitPendingWrite();
330 } 330 }
331 331
332 bool JsonPrefStore::SerializeData(std::string* output) { 332 bool JsonPrefStore::SerializeData(std::string* output) {
333 if (pref_filter_) 333 if (pref_filter_)
334 pref_filter_->FilterSerializeData(prefs_.get()); 334 pref_filter_->FilterSerializeData(prefs_.get());
335 335
336 JSONStringValueSerializer serializer(output); 336 JSONStringValueSerializer serializer(output);
337 serializer.set_pretty_print(true); 337 serializer.set_pretty_print(true);
338 return serializer.Serialize(*prefs_); 338 return serializer.Serialize(*prefs_);
339 } 339 }
OLDNEW
« no previous file with comments | « no previous file | base/prefs/pref_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698