summaryrefslogtreecommitdiff
path: root/third_party/base/allocator/partition_allocator/oom_callback.cc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-16 18:40:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-16 18:40:15 +0000
commitf1fae3cd1b9492cf9411dffd3c486b9672d8cc76 (patch)
treebee5d8b2528e714149d399163519f0fa35ec532b /third_party/base/allocator/partition_allocator/oom_callback.cc
parent1b6fcaad0722fb586620efc974726dee3fb0f80f (diff)
downloadpdfium-f1fae3cd1b9492cf9411dffd3c486b9672d8cc76.tar.xz
Update PartitionAlloc from Chromium at r599712.
BUG=pdfium:1170 Change-Id: I0f8dfb3d517beaa682a9ca7ad4831c5a7a10dc3b Reviewed-on: https://pdfium-review.googlesource.com/c/44073 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'third_party/base/allocator/partition_allocator/oom_callback.cc')
-rw-r--r--third_party/base/allocator/partition_allocator/oom_callback.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/third_party/base/allocator/partition_allocator/oom_callback.cc b/third_party/base/allocator/partition_allocator/oom_callback.cc
new file mode 100644
index 0000000000..36c6e978a2
--- /dev/null
+++ b/third_party/base/allocator/partition_allocator/oom_callback.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/base/allocator/partition_allocator/oom_callback.h"
+#include "third_party/base/logging.h"
+
+namespace pdfium {
+namespace base {
+
+namespace {
+PartitionAllocOomCallback g_oom_callback;
+} // namespace
+
+void SetPartitionAllocOomCallback(PartitionAllocOomCallback callback) {
+ DCHECK(!g_oom_callback);
+ g_oom_callback = callback;
+}
+
+namespace internal {
+void RunPartitionAllocOomCallback() {
+ if (g_oom_callback)
+ g_oom_callback();
+}
+} // namespace internal
+
+} // namespace base
+} // namespace pdfium