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

Side by Side Diff: content/common/set_process_title.cc

Issue 292873002: make debug mode ~20% faster on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: odd dcheck removed Created 6 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/set_process_title.h" 5 #include "content/common/set_process_title.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) 9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS)
10 #include <limits.h> 10 #include <limits.h>
(...skipping 24 matching lines...) Expand all
35 !defined(OS_ANDROID) 35 !defined(OS_ANDROID)
36 36
37 void SetProcessTitleFromCommandLine(const char** main_argv) { 37 void SetProcessTitleFromCommandLine(const char** main_argv) {
38 // Build a single string which consists of all the arguments separated 38 // Build a single string which consists of all the arguments separated
39 // by spaces. We can't actually keep them separate due to the way the 39 // by spaces. We can't actually keep them separate due to the way the
40 // setproctitle() function works. 40 // setproctitle() function works.
41 std::string title; 41 std::string title;
42 bool have_argv0 = false; 42 bool have_argv0 = false;
43 43
44 #if defined(OS_LINUX) 44 #if defined(OS_LINUX)
45 DCHECK_EQ(base::PlatformThread::CurrentId(), getpid());
piman 2014/05/20 05:09:22 nit: maybe DCHECK_EQ(gettid(), getpid()); ? I thi
46
47 if (main_argv) 45 if (main_argv)
48 setproctitle_init(main_argv); 46 setproctitle_init(main_argv);
49 47
50 // In Linux we sometimes exec ourselves from /proc/self/exe, but this makes us 48 // In Linux we sometimes exec ourselves from /proc/self/exe, but this makes us
51 // show up as "exe" in process listings. Read the symlink /proc/self/exe and 49 // show up as "exe" in process listings. Read the symlink /proc/self/exe and
52 // use the path it points at for our process title. Note that this is only for 50 // use the path it points at for our process title. Note that this is only for
53 // display purposes and has no TOCTTOU security implications. 51 // display purposes and has no TOCTTOU security implications.
54 base::FilePath target; 52 base::FilePath target;
55 base::FilePath self_exe(base::kProcSelfExe); 53 base::FilePath self_exe(base::kProcSelfExe);
56 if (base::ReadSymbolicLink(self_exe, &target)) { 54 if (base::ReadSymbolicLink(self_exe, &target)) {
(...skipping 26 matching lines...) Expand all
83 #else 81 #else
84 82
85 // All other systems (basically Windows & Mac) have no need or way to implement 83 // All other systems (basically Windows & Mac) have no need or way to implement
86 // this function. 84 // this function.
87 void SetProcessTitleFromCommandLine(const char** /* main_argv */) { 85 void SetProcessTitleFromCommandLine(const char** /* main_argv */) {
88 } 86 }
89 87
90 #endif 88 #endif
91 89
92 } // namespace content 90 } // namespace content
OLDNEW
« base/threading/platform_thread_posix.cc ('K') | « base/threading/platform_thread_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698