summaryrefslogtreecommitdiffstats
path: root/content/ppapi_plugin/ppapi_thread.cc
diff options
context:
space:
mode:
authorreveman <reveman@chromium.org>2015-04-14 23:12:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-15 06:12:34 +0000
commit3b54d0cd0b78e0fc63a583ae3ec0f1c6a6526a0d (patch)
tree51f50ccece8ddd273ecf4382e04d9100640357d1 /content/ppapi_plugin/ppapi_thread.cc
parent5f288f453ba0eac7f7812041f6efb43b30448b56 (diff)
downloadchromium_src-3b54d0cd0b78e0fc63a583ae3ec0f1c6a6526a0d.zip
chromium_src-3b54d0cd0b78e0fc63a583ae3ec0f1c6a6526a0d.tar.gz
chromium_src-3b54d0cd0b78e0fc63a583ae3ec0f1c6a6526a0d.tar.bz2
content: Set DiscardableMemoryAllocator instance in PpapiThread.
This is required for discardable memory to be available to ppapi processes. BUG=477047 Review URL: https://codereview.chromium.org/1082373002 Cr-Commit-Position: refs/heads/master@{#325192}
Diffstat (limited to 'content/ppapi_plugin/ppapi_thread.cc')
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 88b824f4..13babb4 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -11,6 +11,7 @@
#include "base/debug/crash_logging.h"
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/memory/discardable_memory_allocator.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "base/rand_util.h"
@@ -19,6 +20,7 @@
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "content/child/browser_font_resource_trusted.h"
+#include "content/child/child_discardable_shared_memory_manager.h"
#include "content/child/child_process.h"
#include "content/common/child_process_messages.h"
#include "content/common/sandbox_util.h"
@@ -119,6 +121,13 @@ PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker)
channel()->AddFilter(plugin_filter.get());
plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get());
}
+
+ // In single process, browser main loop set up the discardable memory
+ // allocator.
+ if (!command_line.HasSwitch(switches::kSingleProcess)) {
+ base::DiscardableMemoryAllocator::SetInstance(
+ ChildThreadImpl::discardable_shared_memory_manager());
+ }
}
PpapiThread::~PpapiThread() {