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

Side by Side Diff: chrome/browser/chromeos/system/udev_info_provider.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/system/udev_info_provider.h" 5 #include "chrome/browser/chromeos/system/udev_info_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 26 matching lines...) Expand all
37 virtual bool QueryDeviceProperty(const std::string& sys_path, 37 virtual bool QueryDeviceProperty(const std::string& sys_path,
38 const std::string& property_name, 38 const std::string& property_name,
39 std::string* result) const OVERRIDE; 39 std::string* result) const OVERRIDE;
40 40
41 static UdevInfoProvider* GetInstance(); 41 static UdevInfoProvider* GetInstance();
42 42
43 private: 43 private:
44 DISALLOW_COPY_AND_ASSIGN(UdevInfoProviderImpl); 44 DISALLOW_COPY_AND_ASSIGN(UdevInfoProviderImpl);
45 }; 45 };
46 46
47 base::LazyInstance<UdevInfoProviderImpl> g_udev_info_provider( 47 base::LazyInstance<UdevInfoProviderImpl> g_udev_info_provider =
48 base::LINKER_INITIALIZED); 48 LAZY_INSTANCE_INITIALIZER;
49 49
50 bool UdevInfoProviderImpl::QueryDeviceProperty(const std::string& sys_path, 50 bool UdevInfoProviderImpl::QueryDeviceProperty(const std::string& sys_path,
51 const std::string& property_name, 51 const std::string& property_name,
52 std::string* result) const { 52 std::string* result) const {
53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
54 54
55 FilePath udevadm_path(kUdevadmToolPath); 55 FilePath udevadm_path(kUdevadmToolPath);
56 CommandLine cmd_line(udevadm_path); 56 CommandLine cmd_line(udevadm_path);
57 57
58 // TODO(ivankr): manually appending switches with AppendArg is a workaround 58 // TODO(ivankr): manually appending switches with AppendArg is a workaround
(...skipping 28 matching lines...) Expand all
87 UdevInfoProvider* UdevInfoProviderImpl::GetInstance() { 87 UdevInfoProvider* UdevInfoProviderImpl::GetInstance() {
88 return &g_udev_info_provider.Get(); 88 return &g_udev_info_provider.Get();
89 } 89 }
90 90
91 UdevInfoProvider* UdevInfoProvider::GetInstance() { 91 UdevInfoProvider* UdevInfoProvider::GetInstance() {
92 return UdevInfoProviderImpl::GetInstance(); 92 return UdevInfoProviderImpl::GetInstance();
93 } 93 }
94 94
95 } // namespace system 95 } // namespace system
96 } // namespace chromeos 96 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698