OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/web_memory_dump_provider_adapter.h" | 5 #include "content/child/web_memory_dump_provider_adapter.h" |
6 | 6 |
7 #include "content/child/web_process_memory_dump_impl.h" | 7 #include "content/child/web_process_memory_dump_impl.h" |
8 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" | 8 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 WebMemoryDumpProviderAdapter::WebMemoryDumpProviderAdapter( | 12 WebMemoryDumpProviderAdapter::WebMemoryDumpProviderAdapter( |
13 blink::WebMemoryDumpProvider* wmdp) | 13 blink::WebMemoryDumpProvider* wmdp) |
14 : web_memory_dump_provider_(wmdp), is_registered_(false) { | 14 : web_memory_dump_provider_(wmdp), is_registered_(false) { |
15 } | 15 } |
16 | 16 |
17 WebMemoryDumpProviderAdapter::~WebMemoryDumpProviderAdapter() { | 17 WebMemoryDumpProviderAdapter::~WebMemoryDumpProviderAdapter() { |
18 DCHECK(!is_registered_); | 18 DCHECK(!is_registered_); |
19 } | 19 } |
20 | 20 |
21 bool WebMemoryDumpProviderAdapter::OnMemoryDump( | 21 bool WebMemoryDumpProviderAdapter::OnMemoryDump( |
22 const base::trace_event::MemoryDumpArgs& args, | 22 const base::trace_event::MemoryDumpArgs& args, |
23 base::trace_event::ProcessMemoryDump* pmd) { | 23 base::trace_event::ProcessMemoryDump* pmd) { |
24 blink::WebMemoryDumpLevelOfDetail level; | 24 blink::WebMemoryDumpLevelOfDetail level; |
25 switch (args.level_of_detail) { | 25 switch (args.level_of_detail) { |
26 case base::trace_event::MemoryDumpArgs::LevelOfDetail::LOW: | 26 case base::trace_event::MemoryDumpLevelOfDetail::LIGHT: |
27 level = blink::WebMemoryDumpLevelOfDetail::Low; | 27 // TODO(primiano): switch to actual constant once the corresponding |
| 28 // rename lands in blink and rolls. |
| 29 level = static_cast<blink::WebMemoryDumpLevelOfDetail>(0); |
28 break; | 30 break; |
29 case base::trace_event::MemoryDumpArgs::LevelOfDetail::HIGH: | 31 case base::trace_event::MemoryDumpLevelOfDetail::DETAILED: |
30 level = blink::WebMemoryDumpLevelOfDetail::High; | 32 level = static_cast<blink::WebMemoryDumpLevelOfDetail>(1); |
31 break; | 33 break; |
32 default: | 34 default: |
33 NOTREACHED(); | 35 NOTREACHED(); |
34 return false; | 36 return false; |
35 } | 37 } |
36 WebProcessMemoryDumpImpl web_pmd_impl(pmd); | 38 WebProcessMemoryDumpImpl web_pmd_impl(pmd); |
37 | 39 |
38 return web_memory_dump_provider_->onMemoryDump(level, &web_pmd_impl); | 40 return web_memory_dump_provider_->onMemoryDump(level, &web_pmd_impl); |
39 } | 41 } |
40 | 42 |
41 } // namespace content | 43 } // namespace content |
OLD | NEW |