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

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

Issue 1239493005: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // use the path it points at for our process title. Note that this is only for 52 // 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. 53 // display purposes and has no TOCTTOU security implications.
54 base::FilePath target; 54 base::FilePath target;
55 base::FilePath self_exe(base::kProcSelfExe); 55 base::FilePath self_exe(base::kProcSelfExe);
56 if (base::ReadSymbolicLink(self_exe, &target)) { 56 if (base::ReadSymbolicLink(self_exe, &target)) {
57 have_argv0 = true; 57 have_argv0 = true;
58 title = target.value(); 58 title = target.value();
59 // If the binary has since been deleted, Linux appends " (deleted)" to the 59 // If the binary has since been deleted, Linux appends " (deleted)" to the
60 // symlink target. Remove it, since this is not really part of our name. 60 // symlink target. Remove it, since this is not really part of our name.
61 const std::string kDeletedSuffix = " (deleted)"; 61 const std::string kDeletedSuffix = " (deleted)";
62 if (base::EndsWith(title, kDeletedSuffix, true)) 62 if (base::EndsWith(title, kDeletedSuffix, base::CompareCase::SENSITIVE))
63 title.resize(title.size() - kDeletedSuffix.size()); 63 title.resize(title.size() - kDeletedSuffix.size());
64 64
65 // PR_SET_NAME is available in Linux 2.6.9 and newer. 65 // PR_SET_NAME is available in Linux 2.6.9 and newer.
66 // When available at run time, this sets the short process name that shows 66 // When available at run time, this sets the short process name that shows
67 // when the full command line is not being displayed in most process 67 // when the full command line is not being displayed in most process
68 // listings. 68 // listings.
69 prctl(PR_SET_NAME, base::FilePath(title).BaseName().value().c_str()); 69 prctl(PR_SET_NAME, base::FilePath(title).BaseName().value().c_str());
70 } 70 }
71 #endif // defined(OS_LINUX) 71 #endif // defined(OS_LINUX)
72 72
(...skipping 11 matching lines...) Expand all
84 #else 84 #else
85 85
86 // All other systems (basically Windows & Mac) have no need or way to implement 86 // All other systems (basically Windows & Mac) have no need or way to implement
87 // this function. 87 // this function.
88 void SetProcessTitleFromCommandLine(const char** /* main_argv */) { 88 void SetProcessTitleFromCommandLine(const char** /* main_argv */) {
89 } 89 }
90 90
91 #endif 91 #endif
92 92
93 } // namespace content 93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698