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

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

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply fixes from #10 Created 4 years, 3 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 (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 "components/prefs/json_pref_store.h" 5 #include "components/prefs/json_pref_store.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 DCHECK(CalledOnValidThread()); 319 DCHECK(CalledOnValidThread());
320 320
321 if (pref_filter_) 321 if (pref_filter_)
322 pref_filter_->FilterUpdate(key); 322 pref_filter_->FilterUpdate(key);
323 323
324 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); 324 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
325 325
326 ScheduleWrite(flags); 326 ScheduleWrite(flags);
327 } 327 }
328 328
329 void JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback( 329 void JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback(
gab 2016/09/21 17:55:30 Note for future patch sets : always upload a separ
proberge 2016/09/21 21:09:25 Acknowledged.
330 bool write_success) { 330 bool write_success) {
331 DCHECK(CalledOnValidThread()); 331 DCHECK(CalledOnValidThread());
332 332
333 has_pending_write_callback_ = false; 333 has_pending_write_callback_ = false;
334 if (has_pending_successful_write_reply_) { 334 if (has_pending_successful_write_reply_) {
335 has_pending_successful_write_reply_ = false; 335 has_pending_successful_write_reply_ = false;
336 if (write_success) { 336 if (write_success) {
337 on_next_successful_write_reply_.Run(); 337 on_next_successful_write_reply_.Run();
338 } else { 338 } else {
339 RegisterOnNextSuccessfulWriteReply(on_next_successful_write_reply_); 339 RegisterOnNextSuccessfulWriteReply(on_next_successful_write_reply_);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 CommitPendingWrite(); 455 CommitPendingWrite();
456 } 456 }
457 457
458 bool JsonPrefStore::SerializeData(std::string* output) { 458 bool JsonPrefStore::SerializeData(std::string* output) {
459 DCHECK(CalledOnValidThread()); 459 DCHECK(CalledOnValidThread());
460 460
461 pending_lossy_write_ = false; 461 pending_lossy_write_ = false;
462 462
463 write_count_histogram_.RecordWriteOccured(); 463 write_count_histogram_.RecordWriteOccured();
464 464
465 if (pref_filter_) 465 if (pref_filter_) {
466 pref_filter_->FilterSerializeData(prefs_.get()); 466 base::Callback<void(bool)> pref_filter_post_write_callback =
467 pref_filter_->FilterSerializeData(prefs_.get());
468 if (!pref_filter_post_write_callback.is_null())
469 RegisterOnNextWriteSynchronousCallback(pref_filter_post_write_callback);
470 }
467 471
468 JSONStringValueSerializer serializer(output); 472 JSONStringValueSerializer serializer(output);
469 // Not pretty-printing prefs shrinks pref file size by ~30%. To obtain 473 // Not pretty-printing prefs shrinks pref file size by ~30%. To obtain
470 // readable prefs for debugging purposes, you can dump your prefs into any 474 // readable prefs for debugging purposes, you can dump your prefs into any
471 // command-line or online JSON pretty printing tool. 475 // command-line or online JSON pretty printing tool.
472 serializer.set_pretty_print(false); 476 serializer.set_pretty_print(false);
473 return serializer.Serialize(*prefs_); 477 return serializer.Serialize(*prefs_);
474 } 478 }
475 479
476 void JsonPrefStore::FinalizeFileRead( 480 void JsonPrefStore::FinalizeFileRead(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 DCHECK_EQ(31, num_buckets); 598 DCHECK_EQ(31, num_buckets);
595 599
596 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS 600 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS
597 // macro adapted to allow for a dynamically suffixed histogram name. 601 // macro adapted to allow for a dynamically suffixed histogram name.
598 // Note: The factory creates and owns the histogram. 602 // Note: The factory creates and owns the histogram.
599 base::HistogramBase* histogram = base::Histogram::FactoryGet( 603 base::HistogramBase* histogram = base::Histogram::FactoryGet(
600 histogram_name, min_value, max_value, num_buckets, 604 histogram_name, min_value, max_value, num_buckets,
601 base::HistogramBase::kUmaTargetedHistogramFlag); 605 base::HistogramBase::kUmaTargetedHistogramFlag);
602 return histogram; 606 return histogram;
603 } 607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698