Skip to content

Commit

Permalink
sql: Disable very long running ScopedCriticalAction's on iOS.
Browse files Browse the repository at this point in the history
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 <justincohen@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573770}
  • Loading branch information
Justin Cohen authored and Commit Bot committed Jul 10, 2018
1 parent 3641b5f commit 19ba543
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sql/initialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -33,6 +35,7 @@ void RecordSqliteMemoryWeek() {
const int64_t used = sqlite3_memory_used();
UMA_HISTOGRAM_COUNTS("Sqlite.MemoryKB.OneWeek", used / 1024);
}
#endif // !defined(OS_IOS)

} // anonymous namespace

Expand All @@ -46,8 +49,11 @@ void EnsureSqliteInitialized() {
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),
Expand All @@ -62,7 +68,7 @@ void EnsureSqliteInitialized() {
FROM_HERE, base::BindOnce(&RecordSqliteMemoryWeek),
base::TimeDelta::FromDays(7));
}

#endif // !defined(OS_IOS)
first_call = false;
}
}
Expand Down

0 comments on commit 19ba543

Please sign in to comment.