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

Side by Side Diff: chrome/common/profiling/memlog_sender.cc

Issue 2948283002: Profiling process topology (Closed)
Patch Set: Review comments Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/common/profiling/memlog_sender.h ('k') | chrome/profiling/memlog_stream_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 "chrome/common/profiling/memlog_sender.h" 5 #include "chrome/common/profiling/memlog_sender.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/profiling/memlog_allocator_shim.h" 10 #include "chrome/common/profiling/memlog_allocator_shim.h"
10 #include "chrome/common/profiling/memlog_sender_pipe.h" 11 #include "chrome/common/profiling/memlog_sender_pipe.h"
11 #include "chrome/common/profiling/memlog_stream.h" 12 #include "chrome/common/profiling/memlog_stream.h"
12 13
13 namespace profiling { 14 namespace profiling {
14 15
15 void InitMemlogSenderIfNecessary(const base::CommandLine& cmdline) { 16 void InitMemlogSenderIfNecessary(const base::CommandLine& cmdline) {
16 base::CommandLine::StringType pipe_id = 17 std::string pipe_id = cmdline.GetSwitchValueASCII(switches::kMemlogPipe);
17 cmdline.GetSwitchValueNative(switches::kMemlogPipe); 18 if (!pipe_id.empty())
18 if (pipe_id.empty()) 19 StartMemlogSender(pipe_id);
19 return; // No pipe, don't run. 20 }
20 21
21 static MemlogSenderPipe pipe(pipe_id); 22 void StartMemlogSender(const std::string& pipe_id) {
23 static MemlogSenderPipe pipe(base::UTF8ToUTF16(pipe_id));
22 pipe.Connect(); 24 pipe.Connect();
23 25
24 StreamHeader header; 26 StreamHeader header;
25 header.signature = kStreamSignature; 27 header.signature = kStreamSignature;
26 28
27 pipe.Send(&header, sizeof(StreamHeader)); 29 pipe.Send(&header, sizeof(StreamHeader));
28 30
29 InitAllocatorShim(&pipe); 31 InitAllocatorShim(&pipe);
30 } 32 }
31 33
32 } // namespace profiling 34 } // namespace profiling
OLDNEW
« no previous file with comments | « chrome/common/profiling/memlog_sender.h ('k') | chrome/profiling/memlog_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698