sql: Disable very long running ScopedCriticalAction's on iOS.
We are currently marking all critical actions as iOS long running
tasks, even tasks with delays. Because some tasks have long delays,
we always use the maximum 3 minutes before the system suspends us.
This should be reverted once crbug.com/861889 is fixed and delayed
long running tasks are not marked as iOS-critical until they begin
running.
Bug: 861889
Change-Id: I3654ac9b5d94b5d52abef14a79253bd8a9290077
Reviewed-on: https://chromium-review.googlesource.com/1129829
Commit-Queue: Justin Cohen <[email protected]>
Reviewed-by: Rohit Rao <[email protected]>
Reviewed-by: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#573770}
diff --git a/sql/initialization.cc b/sql/initialization.cc
index 5aaff153..85b8d1e 100644
--- a/sql/initialization.cc
+++ b/sql/initialization.cc
@@ -8,12 +8,14 @@
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/threading/sequenced_task_runner_handle.h"
+#include "build/build_config.h"
#include "third_party/sqlite/sqlite3.h"
namespace sql {
namespace {
+#if !defined(OS_IOS)
void RecordSqliteMemory10Min() {
const int64_t used = sqlite3_memory_used();
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.TenMinutes", used / 1024);
@@ -33,6 +35,7 @@
const int64_t used = sqlite3_memory_used();
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.OneWeek", used / 1024);
}
+#endif // !defined(OS_IOS)
} // anonymous namespace
@@ -46,8 +49,11 @@
if (first_call) {
sqlite3_initialize();
+#if !defined(OS_IOS)
// Schedule callback to record memory footprint histograms at 10m, 1h, and
// 1d. There may not be a registered task runner in tests.
+ // TODO(crbug.com/861889): Disable very long critical tasks on iOS until
+ // 861889 is fixed.
if (base::SequencedTaskRunnerHandle::IsSet()) {
base::SequencedTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::BindOnce(&RecordSqliteMemory10Min),
@@ -62,7 +68,7 @@
FROM_HERE, base::BindOnce(&RecordSqliteMemoryWeek),
base::TimeDelta::FromDays(7));
}
-
+#endif // !defined(OS_IOS)
first_call = false;
}
}