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

Side by Side Diff: remoting/host/policy_watcher.cc

Issue 2911893003: Deprecate NonThreadSafe in remoting 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 | « remoting/host/policy_watcher.h ('k') | remoting/host/setup/win/auth_code_getter.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Most of this code is copied from: 5 // Most of this code is copied from:
6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc}
7 7
8 #include "remoting/host/policy_watcher.h" 8 #include "remoting/host/policy_watcher.h"
9 9
10 #include <utility> 10 #include <utility>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Report that all the policies were well-formed. 135 // Report that all the policies were well-formed.
136 return true; 136 return true;
137 } 137 }
138 138
139 } // namespace 139 } // namespace
140 140
141 void PolicyWatcher::StartWatching( 141 void PolicyWatcher::StartWatching(
142 const PolicyUpdatedCallback& policy_updated_callback, 142 const PolicyUpdatedCallback& policy_updated_callback,
143 const PolicyErrorCallback& policy_error_callback) { 143 const PolicyErrorCallback& policy_error_callback) {
144 DCHECK(CalledOnValidThread()); 144 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
145 DCHECK(!policy_updated_callback.is_null()); 145 DCHECK(!policy_updated_callback.is_null());
146 DCHECK(!policy_error_callback.is_null()); 146 DCHECK(!policy_error_callback.is_null());
147 DCHECK(policy_updated_callback_.is_null()); 147 DCHECK(policy_updated_callback_.is_null());
148 148
149 policy_updated_callback_ = policy_updated_callback; 149 policy_updated_callback_ = policy_updated_callback;
150 policy_error_callback_ = policy_error_callback; 150 policy_error_callback_ = policy_error_callback;
151 151
152 // Listen for future policy changes. 152 // Listen for future policy changes.
153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); 153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this);
154 154
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 default_values_(GetDefaultPolicies()), 200 default_values_(GetDefaultPolicies()),
201 policy_service_(policy_service), 201 policy_service_(policy_service),
202 owned_schema_registry_(std::move(owned_schema_registry)), 202 owned_schema_registry_(std::move(owned_schema_registry)),
203 owned_policy_provider_(std::move(owned_policy_provider)), 203 owned_policy_provider_(std::move(owned_policy_provider)),
204 owned_policy_service_(std::move(owned_policy_service)) { 204 owned_policy_service_(std::move(owned_policy_service)) {
205 DCHECK(policy_service_); 205 DCHECK(policy_service_);
206 DCHECK(owned_schema_registry_); 206 DCHECK(owned_schema_registry_);
207 } 207 }
208 208
209 PolicyWatcher::~PolicyWatcher() { 209 PolicyWatcher::~PolicyWatcher() {
210 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
210 // Stop observing |policy_service_| if StartWatching() has been called. 211 // Stop observing |policy_service_| if StartWatching() has been called.
211 if (!policy_updated_callback_.is_null()) { 212 if (!policy_updated_callback_.is_null()) {
212 policy_service_->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); 213 policy_service_->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this);
213 } 214 }
214 215
215 if (owned_policy_provider_) { 216 if (owned_policy_provider_) {
216 owned_policy_provider_->Shutdown(); 217 owned_policy_provider_->Shutdown();
217 } 218 }
218 } 219 }
219 220
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); 429 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader));
429 #endif // !(OS_CHROMEOS) 430 #endif // !(OS_CHROMEOS)
430 } 431 }
431 432
432 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting( 433 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting(
433 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) { 434 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) {
434 return CreateFromPolicyLoader(std::move(async_policy_loader)); 435 return CreateFromPolicyLoader(std::move(async_policy_loader));
435 } 436 }
436 437
437 } // namespace remoting 438 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/policy_watcher.h ('k') | remoting/host/setup/win/auth_code_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698