| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Compares process priorities and returns an integer that is less | 236 // Compares process priorities and returns an integer that is less |
| 237 // than, equal to or greater than 0 if |priority_lhs| is, | 237 // than, equal to or greater than 0 if |priority_lhs| is, |
| 238 // respectively, lower than, same as or higher than |priority_rhs|. | 238 // respectively, lower than, same as or higher than |priority_rhs|. |
| 239 int ComparePriorities(ProcessPriority priority_lhs, | 239 int ComparePriorities(ProcessPriority priority_lhs, |
| 240 ProcessPriority priority_rhs); | 240 ProcessPriority priority_rhs); |
| 241 | 241 |
| 242 // Sets the current process priority to |priority|. Returns true on | 242 // Sets the current process priority to |priority|. Returns true on |
| 243 // success, false otherwise. | 243 // success, false otherwise. |
| 244 bool SetProcessPriority(ProcessPriority priority); | 244 bool SetProcessPriority(ProcessPriority priority); |
| 245 | 245 |
| 246 // Assumes data points to a Closure. Runs it and returns FALSE; |
| 247 gboolean GlibRunClosure(gpointer data); |
| 248 |
| 246 } // namespace utils | 249 } // namespace utils |
| 247 | 250 |
| 248 // Class to unmount FS when object goes out of scope | 251 // Class to unmount FS when object goes out of scope |
| 249 class ScopedFilesystemUnmounter { | 252 class ScopedFilesystemUnmounter { |
| 250 public: | 253 public: |
| 251 explicit ScopedFilesystemUnmounter(const std::string& mountpoint) | 254 explicit ScopedFilesystemUnmounter(const std::string& mountpoint) |
| 252 : mountpoint_(mountpoint), | 255 : mountpoint_(mountpoint), |
| 253 should_unmount_(true) {} | 256 should_unmount_(true) {} |
| 254 ~ScopedFilesystemUnmounter() { | 257 ~ScopedFilesystemUnmounter() { |
| 255 if (should_unmount_) { | 258 if (should_unmount_) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 if (_error) { \ | 423 if (_error) { \ |
| 421 errno = _error; \ | 424 errno = _error; \ |
| 422 LOG(ERROR) << #_x " failed: " << _error; \ | 425 LOG(ERROR) << #_x " failed: " << _error; \ |
| 423 return false; \ | 426 return false; \ |
| 424 } \ | 427 } \ |
| 425 } while (0) | 428 } while (0) |
| 426 | 429 |
| 427 | 430 |
| 428 | 431 |
| 429 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ | 432 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__ |
| OLD | NEW |