summaryrefslogtreecommitdiffstats
path: root/content/child
diff options
context:
space:
mode:
authorssid <ssid@chromium.org>2015-10-09 04:03:25 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-09 11:04:18 +0000
commit2efc0bf1af654825140ba1b991f497aacd165a04 (patch)
tree00470245c2223605fba5546c4ac8eb59bc7bc966 /content/child
parentfaf57a0c2dceb272f8823251efd08fa4dceb72d0 (diff)
downloadchromium_src-2efc0bf1af654825140ba1b991f497aacd165a04.zip
chromium_src-2efc0bf1af654825140ba1b991f497aacd165a04.tar.gz
chromium_src-2efc0bf1af654825140ba1b991f497aacd165a04.tar.bz2
Expose api to dump discardable memory usage in blink.
This CL adds an api to WebProcessMemoryDump for using base::DiscardableMemory::CreateMemoryAllocatorDump from blink, which is used to dump discardable memory objects, taking into account if the memory is purged or not. BUG=520842 Review URL: https://codereview.chromium.org/1372573003 Cr-Commit-Position: refs/heads/master@{#353262}
Diffstat (limited to 'content/child')
-rw-r--r--content/child/web_discardable_memory_impl.cc10
-rw-r--r--content/child/web_discardable_memory_impl.h3
-rw-r--r--content/child/web_process_memory_dump_impl.cc11
-rw-r--r--content/child/web_process_memory_dump_impl.h5
4 files changed, 29 insertions, 0 deletions
diff --git a/content/child/web_discardable_memory_impl.cc b/content/child/web_discardable_memory_impl.cc
index e2ea7a2..18042b2 100644
--- a/content/child/web_discardable_memory_impl.cc
+++ b/content/child/web_discardable_memory_impl.cc
@@ -6,6 +6,8 @@
#include "base/memory/discardable_memory.h"
#include "base/memory/discardable_memory_allocator.h"
+#include "content/child/web_process_memory_dump_impl.h"
+#include "third_party/WebKit/public/platform/WebString.h"
namespace content {
@@ -31,6 +33,14 @@ void* WebDiscardableMemoryImpl::data() {
return discardable_->data();
}
+blink::WebMemoryAllocatorDump*
+WebDiscardableMemoryImpl::createMemoryAllocatorDump(
+ const blink::WebString& name,
+ blink::WebProcessMemoryDump* wpmd) const {
+ return static_cast<content::WebProcessMemoryDumpImpl*>(wpmd)
+ ->CreateDiscardableMemoryAllocatorDump(name.utf8(), discardable_.get());
+}
+
WebDiscardableMemoryImpl::WebDiscardableMemoryImpl(
scoped_ptr<base::DiscardableMemory> memory)
: discardable_(memory.Pass()) {
diff --git a/content/child/web_discardable_memory_impl.h b/content/child/web_discardable_memory_impl.h
index c3c8f5d..4c589a4 100644
--- a/content/child/web_discardable_memory_impl.h
+++ b/content/child/web_discardable_memory_impl.h
@@ -27,6 +27,9 @@ class WebDiscardableMemoryImpl : public blink::WebDiscardableMemory {
bool lock() override;
void unlock() override;
void* data() override;
+ blink::WebMemoryAllocatorDump* createMemoryAllocatorDump(
+ const blink::WebString& name,
+ blink::WebProcessMemoryDump* wpmd) const override;
private:
WebDiscardableMemoryImpl(scoped_ptr<base::DiscardableMemory> memory);
diff --git a/content/child/web_process_memory_dump_impl.cc b/content/child/web_process_memory_dump_impl.cc
index 95197da..1d769dd 100644
--- a/content/child/web_process_memory_dump_impl.cc
+++ b/content/child/web_process_memory_dump_impl.cc
@@ -4,6 +4,7 @@
#include "content/child/web_process_memory_dump_impl.h"
+#include "base/memory/discardable_memory.h"
#include "base/trace_event/process_memory_dump.h"
#include "content/child/web_memory_allocator_dump_impl.h"
#include "skia/ext/skia_trace_memory_dump_impl.h"
@@ -149,4 +150,14 @@ SkTraceMemoryDump* WebProcessMemoryDumpImpl::CreateDumpAdapterForSkia(
return sk_trace_dump_list_.back();
}
+blink::WebMemoryAllocatorDump*
+WebProcessMemoryDumpImpl::CreateDiscardableMemoryAllocatorDump(
+ const std::string& name,
+ base::DiscardableMemory* discardable) {
+ base::trace_event::MemoryAllocatorDump* dump =
+ discardable->CreateMemoryAllocatorDump(name.c_str(),
+ process_memory_dump_);
+ return createWebMemoryAllocatorDump(dump);
+}
+
} // namespace content
diff --git a/content/child/web_process_memory_dump_impl.h b/content/child/web_process_memory_dump_impl.h
index 33f2fd2..4e5fb26 100644
--- a/content/child/web_process_memory_dump_impl.h
+++ b/content/child/web_process_memory_dump_impl.h
@@ -14,6 +14,7 @@
#include "third_party/WebKit/public/platform/WebProcessMemoryDump.h"
namespace base {
+class DiscardableMemory;
namespace trace_event {
class MemoryAllocatorDump;
class ProcessMemoryDump;
@@ -69,6 +70,10 @@ class CONTENT_EXPORT WebProcessMemoryDumpImpl final
return process_memory_dump_;
}
+ blink::WebMemoryAllocatorDump* CreateDiscardableMemoryAllocatorDump(
+ const std::string& name,
+ base::DiscardableMemory* discardable);
+
private:
FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpImplTest, IntegrationTest);