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

Side by Side Diff: content/renderer/memory_benchmarking_extension.cc

Issue 1469843002: Remove dependency on allocator from 'content' targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unify_allocator1_2
Patch Set: Fix build Created 5 years 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/memory_benchmarking_extension.h" 5 #include "content/renderer/memory_benchmarking_extension.h"
6 6
7 #include "content/common/memory_benchmark_messages.h" 7 #include "content/common/memory_benchmark_messages.h"
8 #include "content/renderer/chrome_object_extensions_utils.h" 8 #include "content/renderer/chrome_object_extensions_utils.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "gin/arguments.h" 10 #include "gin/arguments.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return gin::Wrappable<MemoryBenchmarkingExtension>::GetObjectTemplateBuilder( 51 return gin::Wrappable<MemoryBenchmarkingExtension>::GetObjectTemplateBuilder(
52 isolate) 52 isolate)
53 .SetMethod("isHeapProfilerRunning", 53 .SetMethod("isHeapProfilerRunning",
54 &MemoryBenchmarkingExtension::IsHeapProfilerRunning) 54 &MemoryBenchmarkingExtension::IsHeapProfilerRunning)
55 .SetMethod("heapProfilerDump", 55 .SetMethod("heapProfilerDump",
56 &MemoryBenchmarkingExtension::HeapProfilerDump); 56 &MemoryBenchmarkingExtension::HeapProfilerDump);
57 } 57 }
58 58
59 bool MemoryBenchmarkingExtension::IsHeapProfilerRunning() { 59 bool MemoryBenchmarkingExtension::IsHeapProfilerRunning() {
60 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) 60 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID))
61 return ::IsHeapProfilerRunning(); 61 return base::allocator::IsHeapProfilerRunning();
62 #else 62 #else
63 return false; 63 return false;
64 #endif 64 #endif
65 } 65 }
66 66
67 void MemoryBenchmarkingExtension::HeapProfilerDump(gin::Arguments* args) { 67 void MemoryBenchmarkingExtension::HeapProfilerDump(gin::Arguments* args) {
68 std::string process_type; 68 std::string process_type;
69 std::string reason("benchmarking_extension"); 69 std::string reason("benchmarking_extension");
70 70
71 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsString()) { 71 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsString()) {
72 args->GetNext(&process_type); 72 args->GetNext(&process_type);
73 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsString()) 73 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsString())
74 args->GetNext(&reason); 74 args->GetNext(&reason);
75 } 75 }
76 76
77 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) 77 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID))
78 if (process_type == "browser") { 78 if (process_type == "browser") {
79 content::RenderThreadImpl::current()->Send( 79 content::RenderThreadImpl::current()->Send(
80 new MemoryBenchmarkHostMsg_HeapProfilerDump(reason)); 80 new MemoryBenchmarkHostMsg_HeapProfilerDump(reason));
81 } else { 81 } else {
82 ::HeapProfilerDump(reason.c_str()); 82 base::allocator::HeapProfilerDump(reason.c_str());
83 } 83 }
84 #endif 84 #endif
85 } 85 }
86 86
87 } // namespace content 87 } // namespace content
OLDNEW
« base/allocator/allocator_extension.cc ('K') | « content/child/child_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698