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

Unified Diff: chromecast/base/file_utils.h

Issue 2203123003: [Chromecast] Remove usage of nonreentrant functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: slan@ comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromecast/base/BUILD.gn ('k') | chromecast/base/file_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/base/file_utils.h
diff --git a/chromecast/base/file_utils.h b/chromecast/base/file_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..69fe23d3a47ef1db178700717efb6d31c6ebc101
--- /dev/null
+++ b/chromecast/base/file_utils.h
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_BASE_FILE_UTILS_H_
+#define CHROMECAST_BASE_FILE_UTILS_H_
+
+#include "base/files/file_path.h"
+
+namespace chromecast {
+
+// Lock a file (blocking request) with filepath |path|. Returns the file
+// descriptor on success, an invalid file descriptor (-1) on failure. Failure
+// indicates that |path| does not exist, or the locking procedure failed.
+// A true |write| value opens the file in RW mode, false opens in R-only.
+int OpenAndLockFile(const base::FilePath& path, bool write);
+
+// Unlock a file (blocking request) denoted by file descriptor |fd|. Returns
+// true on success, false on failure.
+bool UnlockAndCloseFile(const int fd);
+
+} // namespace chromecast
+
+#endif // CHROMECAST_BASE_FILE_UTILS_H_
« no previous file with comments | « chromecast/base/BUILD.gn ('k') | chromecast/base/file_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698