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

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

Issue 2908263002: Replace deprecated base::NonThreadSafe in components/prefs in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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 | « components/prefs/scoped_user_pref_update.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/scoped_user_pref_update.h" 5 #include "components/prefs/scoped_user_pref_update.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/prefs/pref_notifier.h" 8 #include "components/prefs/pref_notifier.h"
9 #include "components/prefs/pref_service.h" 9 #include "components/prefs/pref_service.h"
10 10
11 namespace subtle { 11 namespace subtle {
12 12
13 ScopedUserPrefUpdateBase::ScopedUserPrefUpdateBase(PrefService* service, 13 ScopedUserPrefUpdateBase::ScopedUserPrefUpdateBase(PrefService* service,
14 const std::string& path) 14 const std::string& path)
15 : service_(service), path_(path), value_(NULL) { 15 : service_(service), path_(path), value_(NULL) {
16 DCHECK(service_->CalledOnValidThread()); 16 DCHECK_CALLED_ON_VALID_SEQUENCE(service_->sequence_checker_);
17 } 17 }
18 18
19 ScopedUserPrefUpdateBase::~ScopedUserPrefUpdateBase() { 19 ScopedUserPrefUpdateBase::~ScopedUserPrefUpdateBase() {
20 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
20 Notify(); 21 Notify();
21 } 22 }
22 23
23 base::Value* ScopedUserPrefUpdateBase::GetValueOfType(base::Value::Type type) { 24 base::Value* ScopedUserPrefUpdateBase::GetValueOfType(base::Value::Type type) {
24 DCHECK(CalledOnValidThread()); 25 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
25 if (!value_) 26 if (!value_)
26 value_ = service_->GetMutableUserPref(path_, type); 27 value_ = service_->GetMutableUserPref(path_, type);
27 return value_; 28 return value_;
28 } 29 }
29 30
30 void ScopedUserPrefUpdateBase::Notify() { 31 void ScopedUserPrefUpdateBase::Notify() {
31 if (value_) { 32 if (value_) {
32 service_->ReportUserPrefChanged(path_); 33 service_->ReportUserPrefChanged(path_);
33 value_ = NULL; 34 value_ = NULL;
34 } 35 }
35 } 36 }
36 37
37 } // namespace subtle 38 } // namespace subtle
OLDNEW
« no previous file with comments | « components/prefs/scoped_user_pref_update.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698