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

Side by Side Diff: base/linux_util.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add \n Created 5 years, 3 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
OLDNEW
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 "base/linux_util.h" 5 #include "base/linux_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 19 matching lines...) Expand all
30 STATE_DID_NOT_CHECK = 0, 30 STATE_DID_NOT_CHECK = 0,
31 STATE_CHECK_STARTED = 1, 31 STATE_CHECK_STARTED = 1,
32 STATE_CHECK_FINISHED = 2, 32 STATE_CHECK_FINISHED = 2,
33 }; 33 };
34 34
35 // Helper class for GetLinuxDistro(). 35 // Helper class for GetLinuxDistro().
36 class LinuxDistroHelper { 36 class LinuxDistroHelper {
37 public: 37 public:
38 // Retrieves the Singleton. 38 // Retrieves the Singleton.
39 static LinuxDistroHelper* GetInstance() { 39 static LinuxDistroHelper* GetInstance() {
40 return Singleton<LinuxDistroHelper>::get(); 40 return base::Singleton<LinuxDistroHelper>::get();
41 } 41 }
42 42
43 // The simple state machine goes from: 43 // The simple state machine goes from:
44 // STATE_DID_NOT_CHECK -> STATE_CHECK_STARTED -> STATE_CHECK_FINISHED. 44 // STATE_DID_NOT_CHECK -> STATE_CHECK_STARTED -> STATE_CHECK_FINISHED.
45 LinuxDistroHelper() : state_(STATE_DID_NOT_CHECK) {} 45 LinuxDistroHelper() : state_(STATE_DID_NOT_CHECK) {}
46 ~LinuxDistroHelper() {} 46 ~LinuxDistroHelper() {}
47 47
48 // Retrieve the current state, if we're in STATE_DID_NOT_CHECK, 48 // Retrieve the current state, if we're in STATE_DID_NOT_CHECK,
49 // we automatically move to STATE_CHECK_STARTED so nobody else will 49 // we automatically move to STATE_CHECK_STARTED so nobody else will
50 // do the check. 50 // do the check.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 if (0 == strncmp(expected_data.c_str(), syscall_data.get(), 171 if (0 == strncmp(expected_data.c_str(), syscall_data.get(),
172 expected_data.length())) { 172 expected_data.length())) {
173 return current_tid; 173 return current_tid;
174 } 174 }
175 } 175 }
176 return -1; 176 return -1;
177 } 177 }
178 178
179 } // namespace base 179 } // namespace base
OLDNEW
« no previous file with comments | « ash/touch/touch_uma.cc ('k') | base/logging_win.h » ('j') | base/logging_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698