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

Side by Side Diff: chrome/browser/chromeos/login/signed_settings_helper.cc

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/login/signed_settings_helper.h" 5 #include "chrome/browser/chromeos/login/signed_settings_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
12 #include "base/singleton.h"
13 #include "chrome/browser/browser_thread.h" 13 #include "chrome/browser/browser_thread.h"
14 #include "chrome/browser/chromeos/login/signed_settings.h" 14 #include "chrome/browser/chromeos/login/signed_settings.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 namespace { 18 namespace {
19 19
20 class OpContext { 20 class OpContext {
21 public: 21 public:
22 class Delegate { 22 class Delegate {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 private: 303 private:
304 SignedSettingsHelperImpl(); 304 SignedSettingsHelperImpl();
305 ~SignedSettingsHelperImpl(); 305 ~SignedSettingsHelperImpl();
306 306
307 void AddOpContext(OpContext* context); 307 void AddOpContext(OpContext* context);
308 void ClearAll(); 308 void ClearAll();
309 309
310 std::vector<OpContext*> pending_contexts_; 310 std::vector<OpContext*> pending_contexts_;
311 311
312 friend struct DefaultSingletonTraits<SignedSettingsHelperImpl>; 312 friend struct base::DefaultLazyInstanceTraits<SignedSettingsHelperImpl>;
313 DISALLOW_COPY_AND_ASSIGN(SignedSettingsHelperImpl); 313 DISALLOW_COPY_AND_ASSIGN(SignedSettingsHelperImpl);
314 }; 314 };
315 315
316 static base::LazyInstance<SignedSettingsHelperImpl>
M-A Ruel 2010/12/10 14:52:18 I highly prefer to not make these file local stati
317 g_signed_settings_helper_impl(base::LINKER_INITIALIZED);
318
316 SignedSettingsHelperImpl::SignedSettingsHelperImpl() { 319 SignedSettingsHelperImpl::SignedSettingsHelperImpl() {
317 } 320 }
318 321
319 SignedSettingsHelperImpl::~SignedSettingsHelperImpl() { 322 SignedSettingsHelperImpl::~SignedSettingsHelperImpl() {
320 if (!pending_contexts_.empty()) { 323 if (!pending_contexts_.empty()) {
321 LOG(WARNING) << "SignedSettingsHelperImpl shutdown with pending ops, " 324 LOG(WARNING) << "SignedSettingsHelperImpl shutdown with pending ops, "
322 << "changes will be lost."; 325 << "changes will be lost.";
323 ClearAll(); 326 ClearAll();
324 } 327 }
325 } 328 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 414
412 pending_contexts_.erase(pending_contexts_.begin()); 415 pending_contexts_.erase(pending_contexts_.begin());
413 if (!pending_contexts_.empty()) 416 if (!pending_contexts_.empty())
414 pending_contexts_.front()->Execute(); 417 pending_contexts_.front()->Execute();
415 418
416 if (test_delegate_) 419 if (test_delegate_)
417 test_delegate_->OnOpCompleted(context->op()); 420 test_delegate_->OnOpCompleted(context->op());
418 } 421 }
419 422
420 SignedSettingsHelper* SignedSettingsHelper::Get() { 423 SignedSettingsHelper* SignedSettingsHelper::Get() {
421 return Singleton<SignedSettingsHelperImpl>::get(); 424 return g_signed_settings_helper_impl.Pointer();
422 } 425 }
423 426
424 } // namespace chromeos 427 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698