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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 1015153002: Commit History transaction when app is backgrounded on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: components/history/core/browser/history_backend.cc
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index c35e8c40923ec7034039b733ac5cb1552acc159d..a1fdba9652e622ae13848bb9c8f637029e95f0ab 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -44,6 +44,10 @@
#include "url/gurl.h"
#include "url/url_constants.h"
+#if defined(OS_IOS)
+#include "base/ios/scoped_critical_action.h"
+#endif
+
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
@@ -260,6 +264,12 @@ void HistoryBackend::Closing() {
delegate_.reset();
}
+#if defined(OS_IOS)
+void HistoryBackend::PersistState() {
+ Commit();
+}
+#endif
+
void HistoryBackend::ClearCachedDataForContextID(ContextID context_id) {
tracker_.ClearCachedDataForContextID(context_id);
}
@@ -2168,6 +2178,12 @@ void HistoryBackend::Commit() {
if (!db_)
return;
+#if defined(OS_IOS)
+ // Attempts to get the application running long enough to commit the database
+ // transaction if it is currently being backgrounded.
+ base::ios::ScopedCriticalAction scoped_critical_action;
+#endif
+
// Note that a commit may not actually have been scheduled if a caller
// explicitly calls this instead of using ScheduleCommit. Likewise, we
// may reset the flag written by a pending commit. But this is OK! It
« no previous file with comments | « components/history/core/browser/history_backend.h ('k') | components/history/core/browser/history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698