OLD | NEW |
---|---|
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 base::Bind(&JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback, | 375 base::Bind(&JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback, |
376 AsWeakPtr()), | 376 AsWeakPtr()), |
377 base::Callback<void(bool success)>(), | 377 base::Callback<void(bool success)>(), |
378 base::SequencedTaskRunnerHandle::Get())); | 378 base::SequencedTaskRunnerHandle::Get())); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 void JsonPrefStore::RegisterOnNextWriteSynchronousCallbacks( | 382 void JsonPrefStore::RegisterOnNextWriteSynchronousCallbacks( |
383 OnWriteCallbackPair callbacks) { | 383 OnWriteCallbackPair callbacks) { |
384 DCHECK(CalledOnValidThread()); | 384 DCHECK(CalledOnValidThread()); |
385 DCHECK(!has_pending_write_callbacks_); | |
386 | 385 |
387 has_pending_write_callbacks_ = true; | 386 has_pending_write_callbacks_ = true; |
388 | 387 |
388 // Note that this shouldn't clobber callbacks previously added by this method, | |
389 // as |writer_|'s WriteNow() will be called in sequence. | |
gab
2016/10/04 19:05:32
I don't think this comment is required, it's never
proberge
2016/10/04 20:17:58
Done.
| |
389 writer_.RegisterOnNextWriteCallbacks( | 390 writer_.RegisterOnNextWriteCallbacks( |
390 callbacks.first, | 391 callbacks.first, |
391 base::Bind( | 392 base::Bind( |
392 &PostWriteCallback, | 393 &PostWriteCallback, |
393 base::Bind(&JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback, | 394 base::Bind(&JsonPrefStore::RunOrScheduleNextSuccessfulWriteCallback, |
394 AsWeakPtr()), | 395 AsWeakPtr()), |
395 callbacks.second, base::SequencedTaskRunnerHandle::Get())); | 396 callbacks.second, base::SequencedTaskRunnerHandle::Get())); |
396 } | 397 } |
397 | 398 |
398 void JsonPrefStore::ClearMutableValues() { | 399 void JsonPrefStore::ClearMutableValues() { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 DCHECK_EQ(31, num_buckets); | 603 DCHECK_EQ(31, num_buckets); |
603 | 604 |
604 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS | 605 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS |
605 // macro adapted to allow for a dynamically suffixed histogram name. | 606 // macro adapted to allow for a dynamically suffixed histogram name. |
606 // Note: The factory creates and owns the histogram. | 607 // Note: The factory creates and owns the histogram. |
607 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 608 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
608 histogram_name, min_value, max_value, num_buckets, | 609 histogram_name, min_value, max_value, num_buckets, |
609 base::HistogramBase::kUmaTargetedHistogramFlag); | 610 base::HistogramBase::kUmaTargetedHistogramFlag); |
610 return histogram; | 611 return histogram; |
611 } | 612 } |
OLD | NEW |