OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |