blob: 3860e7e78bc977dadbe2d5878f94229d8228aa0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright 2015 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 "config.h"
#include "platform/MemoryPurgeController.h"
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
#include "wtf/Partitions.h"
namespace blink {
DEFINE_TRACE(MemoryPurgeClient)
{
}
MemoryPurgeController::MemoryPurgeController()
: m_deviceKind(Platform::current()->isLowEndDeviceMode() ? DeviceKind::LowEnd : DeviceKind::NotSpecified)
{
}
MemoryPurgeController::~MemoryPurgeController()
{
}
void MemoryPurgeController::purgeMemory()
{
// TODO(bashi): Add UMA
TRACE_EVENT0("blink", "MemoryPurgeController::purgeMemory");
for (auto& client : m_clients)
client->purgeMemory(m_deviceKind);
WTF::Partitions::decommitFreeableMemory();
}
DEFINE_TRACE(MemoryPurgeController)
{
#if ENABLE(OILPAN)
visitor->trace(m_clients);
#endif
}
} // namespace blink
|