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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java

Issue 2465203003: [Android WebView] Keep a reference to the exclusive data dir lock file. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
index 5bc5ed20db83fbd55e62eb8c2593276e57d6b097..9c5d8d6ff198b830457d65a59c69500bf56a32cc 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
@@ -35,6 +35,7 @@ public abstract class AwBrowserProcess {
private static final String TAG = "AwBrowserProcess";
private static final String EXCLUSIVE_LOCK_FILE = "webview_data.lock";
+ private static RandomAccessFile sLockFile;
private static FileLock sExclusiveFileLock;
/**
@@ -115,9 +116,9 @@ public abstract class AwBrowserProcess {
File lockFile = new File(dataPath, EXCLUSIVE_LOCK_FILE);
boolean success = false;
try {
- // Note that the file is not closed intentionally.
- RandomAccessFile file = new RandomAccessFile(lockFile, "rw");
- sExclusiveFileLock = file.getChannel().tryLock();
+ // Note that the file is kept open intentionally.
+ sLockFile = new RandomAccessFile(lockFile, "rw");
+ sExclusiveFileLock = sLockFile.getChannel().tryLock();
success = sExclusiveFileLock != null;
} catch (IOException e) {
Log.w(TAG, "Failed to create lock file " + lockFile, e);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698