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

Unified Diff: runtime/bin/file.h

Issue 833623004: Add support for file locking (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows test Created 5 years, 11 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
Index: runtime/bin/file.h
diff --git a/runtime/bin/file.h b/runtime/bin/file.h
index 990b7b220d43a63c3bf84bd8d5a3427a816602dc..7a8107fd91f4f16629aec759ee9ba50e46aa1281 100644
--- a/runtime/bin/file.h
+++ b/runtime/bin/file.h
@@ -69,6 +69,15 @@ class File {
kStatSize = 6
};
+ enum LockType {
+ // These match the constants in FileStat in file_impl.dart.
+ kLockMin = 0,
+ kLockUnlock = 0,
+ kLockShared = 1,
+ kLockExclusive = 2,
+ kLockMax = 2
+ };
+
~File();
intptr_t GetFD();
@@ -105,6 +114,9 @@ class File {
// Flush contents of file.
bool Flush();
+ // Lock range of a file.
+ bool Lock(LockType lock, int64_t start, int64_t end);
+
// Returns whether the file has been closed.
bool IsClosed();
@@ -168,6 +180,7 @@ class File {
static CObject* TypeRequest(const CObjectArray& request);
static CObject* IdenticalRequest(const CObjectArray& request);
static CObject* StatRequest(const CObjectArray& request);
+ static CObject* LockRequest(const CObjectArray& request);
private:
explicit File(FileHandle* handle) : handle_(handle) { }
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/file.cc » ('j') | sdk/lib/io/file.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698