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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java

Issue 1852333002: Always close non-null output stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Close stream at caller. Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
index 83f4267d86e4a1c56f2890ba39edc43fe8e12d5b..d7384785e29a6b2ac65bd80b3c7a4c7e13402945 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -329,17 +329,20 @@ public class TabPersistentStore extends TabPersister {
for (Tab tab : mTabsToSave) {
int id = tab.getId();
boolean incognito = tab.isIncognito();
+ FileOutputStream stream = null;
try {
TabState state = tab.getState();
if (state != null) {
- TabState.saveState(
- openTabStateOutputStream(id, incognito), state, incognito);
+ stream = openTabStateOutputStream(id, incognito);
+ TabState.saveState(stream, state, incognito);
}
} catch (IOException e) {
logSaveException(e);
} catch (OutOfMemoryError e) {
Log.w(TAG, "Out of memory error while attempting to save tab state. Erasing.");
deleteTabState(id, incognito);
+ } finally {
+ StreamUtil.closeQuietly(stream);
}
}
mTabsToSave.clear();
« 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