OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "chrome/common/profiling/memlog_sender.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/profiling/memlog_allocator_shim.h" |
| 10 #include "chrome/common/profiling/memlog_sender_pipe.h" |
| 11 #include "chrome/common/profiling/memlog_stream.h" |
| 12 |
| 13 namespace profiling { |
| 14 |
| 15 void InitMemlogSenderIfNecessary(const base::CommandLine& cmdline) { |
| 16 base::CommandLine::StringType pipe_id = |
| 17 cmdline.GetSwitchValueNative(switches::kMemlogPipe); |
| 18 if (pipe_id.empty()) |
| 19 return; // No pipe, don't run. |
| 20 |
| 21 static MemlogSenderPipe pipe(pipe_id); |
| 22 pipe.Connect(); |
| 23 |
| 24 StreamHeader header; |
| 25 header.signature = kStreamSignature; |
| 26 |
| 27 pipe.Send(&header, sizeof(StreamHeader)); |
| 28 |
| 29 InitAllocatorShim(&pipe); |
| 30 } |
| 31 |
| 32 } // namespace profiling |
OLD | NEW |