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 <errno.h> | 5 #include <errno.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <sys/file.h> | 7 #include <sys/file.h> |
8 | 8 |
9 #include "chrome/browser/process_singleton.h" | 9 #include "chrome/browser/process_singleton.h" |
10 | 10 |
11 #include "base/eintr_wrapper.h" | |
12 #include "base/file_util.h" | 11 #include "base/file_util.h" |
13 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/posix/eintr_wrapper.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // From "man 2 intro", the largest errno is |EOPNOTSUPP|, which is | 18 // From "man 2 intro", the largest errno is |EOPNOTSUPP|, which is |
19 // |102|. Since the histogram memory usage is proportional to this | 19 // |102|. Since the histogram memory usage is proportional to this |
20 // number, using the |102| directly rather than the macro. | 20 // number, using the |102| directly rather than the macro. |
21 const int kMaxErrno = 102; | 21 const int kMaxErrno = 102; |
22 | 22 |
23 } // namespace | 23 } // namespace |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 void ProcessSingleton::Cleanup() { | 113 void ProcessSingleton::Cleanup() { |
114 // Closing the file also releases the lock. | 114 // Closing the file also releases the lock. |
115 if (lock_fd_ != -1) { | 115 if (lock_fd_ != -1) { |
116 int rc = HANDLE_EINTR(close(lock_fd_)); | 116 int rc = HANDLE_EINTR(close(lock_fd_)); |
117 DPCHECK(!rc) << "Closing lock_fd_:"; | 117 DPCHECK(!rc) << "Closing lock_fd_:"; |
118 } | 118 } |
119 lock_fd_ = -1; | 119 lock_fd_ = -1; |
120 } | 120 } |
OLD | NEW |