Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: third_party/WebKit/Source/platform/MemoryUsageProvider.cpp

Issue 1670463002: [Oilpan] Unify memory usage reporters of Oilpan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Watch out only Oilpan heap usages Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/MemoryUsageProvider.h"
6
7 #include "platform/heap/Heap.h"
8 #include "public/platform/WebMemoryAllocatorDump.h"
9 #include "public/platform/WebProcessMemoryDump.h"
10 #include "wtf/Partitions.h"
11 #include "wtf/Threading.h"
12 #include "wtf/text/WTFString.h"
13
14 #include <v8.h>
15
16 namespace blink {
17
18 MemoryUsageProvider* MemoryUsageProvider::instance()
19 {
20 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<MemoryUsageProvider>, provide r, new ThreadSpecific<MemoryUsageProvider>);
21 return provider;
22 }
23
24 MemoryUsageProvider::MemoryUsageProvider()
25 : m_isolate(nullptr)
26 , m_previousSize(0)
27 {
28 }
29
30 MemoryUsageProvider::~MemoryUsageProvider()
31 {
32 }
33
34 bool MemoryUsageProvider::adjustAmountOfAllocatedMemory()
35 {
36 if (!m_isolate)
37 return false;
38
39 // TODO(peria): Use thread specific heap usage methods, if available.
40 int64_t currentTotalSize = Heap::allocatedObjectSize() + Heap::markedObjectS ize();
haraken 2016/02/08 11:17:20 This is not what we want to report. Heap::allocate
peria 2016/02/09 06:39:59 Done.
41 int64_t diff = currentTotalSize - m_previousSize;
42 m_isolate->AdjustAmountOfExternalAllocatedMemory(diff);
43 m_previousSize = currentTotalSize;
44
45 return true;
46 }
47
48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698