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

Unified Diff: chrome/common/profiling/memlog_sender.cc

Issue 2949703002: Add OOP memory logging allocator shim (Closed)
Patch Set: More comments Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/profiling/memlog_sender.cc
diff --git a/chrome/common/profiling/memlog_sender.cc b/chrome/common/profiling/memlog_sender.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4b3160b7261d8962fc636fae4852387684bc1325
--- /dev/null
+++ b/chrome/common/profiling/memlog_sender.cc
@@ -0,0 +1,32 @@
+// Copyright 2017 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 "chrome/common/profiling/memlog_sender.h"
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/profiling/memlog_allocator_shim.h"
+#include "chrome/common/profiling/memlog_sender_pipe.h"
+#include "chrome/common/profiling/memlog_stream.h"
+
+namespace profiling {
+
+void InitMemlogSenderIfNecessary(const base::CommandLine& cmdline) {
+ base::CommandLine::StringType pipe_id =
+ cmdline.GetSwitchValueNative(switches::kMemlogPipe);
+ if (pipe_id.empty())
+ return; // No pipe, don't run.
+
+ static MemlogSenderPipe pipe(pipe_id);
+ pipe.Connect();
+
+ StreamHeader header;
+ header.signature = kStreamSignature;
+
+ pipe.Send(&header, sizeof(StreamHeader));
+
+ InitAllocatorShim(&pipe);
+}
+
+} // namespace profiling

Powered by Google App Engine
This is Rietveld 408576698