OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // On Linux, when the user tries to launch a second copy of chrome, we check | 5 // On Linux, when the user tries to launch a second copy of chrome, we check |
6 // for a socket in the user's profile directory. If the socket file is open we | 6 // for a socket in the user's profile directory. If the socket file is open we |
7 // send a message to the first chrome browser process with the current | 7 // send a message to the first chrome browser process with the current |
8 // directory and second process command line flags. The second process then | 8 // directory and second process command line flags. The second process then |
9 // exits. | 9 // exits. |
10 // | 10 // |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include <unistd.h> | 49 #include <unistd.h> |
50 | 50 |
51 #include <cstring> | 51 #include <cstring> |
52 #include <set> | 52 #include <set> |
53 #include <string> | 53 #include <string> |
54 | 54 |
55 #include "base/base_paths.h" | 55 #include "base/base_paths.h" |
56 #include "base/basictypes.h" | 56 #include "base/basictypes.h" |
57 #include "base/bind.h" | 57 #include "base/bind.h" |
58 #include "base/command_line.h" | 58 #include "base/command_line.h" |
59 #include "base/file_util.h" | |
60 #include "base/files/file_path.h" | 59 #include "base/files/file_path.h" |
| 60 #include "base/files/file_util.h" |
61 #include "base/logging.h" | 61 #include "base/logging.h" |
62 #include "base/message_loop/message_loop.h" | 62 #include "base/message_loop/message_loop.h" |
63 #include "base/path_service.h" | 63 #include "base/path_service.h" |
64 #include "base/posix/eintr_wrapper.h" | 64 #include "base/posix/eintr_wrapper.h" |
65 #include "base/rand_util.h" | 65 #include "base/rand_util.h" |
66 #include "base/safe_strerror_posix.h" | 66 #include "base/safe_strerror_posix.h" |
67 #include "base/sequenced_task_runner_helpers.h" | 67 #include "base/sequenced_task_runner_helpers.h" |
68 #include "base/stl_util.h" | 68 #include "base/stl_util.h" |
69 #include "base/strings/string_number_conversions.h" | 69 #include "base/strings/string_number_conversions.h" |
70 #include "base/strings/string_split.h" | 70 #include "base/strings/string_split.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1045 } |
1046 | 1046 |
1047 void ProcessSingleton::KillProcess(int pid) { | 1047 void ProcessSingleton::KillProcess(int pid) { |
1048 // TODO(james.su@gmail.com): Is SIGKILL ok? | 1048 // TODO(james.su@gmail.com): Is SIGKILL ok? |
1049 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); | 1049 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); |
1050 // ESRCH = No Such Process (can happen if the other process is already in | 1050 // ESRCH = No Such Process (can happen if the other process is already in |
1051 // progress of shutting down and finishes before we try to kill it). | 1051 // progress of shutting down and finishes before we try to kill it). |
1052 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " | 1052 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " |
1053 << safe_strerror(errno); | 1053 << safe_strerror(errno); |
1054 } | 1054 } |
OLD | NEW |