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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 void WillDestroyCurrentMessageLoop() override { | 552 void WillDestroyCurrentMessageLoop() override { |
553 fd_watcher_.StopWatchingFileDescriptor(); | 553 fd_watcher_.StopWatchingFileDescriptor(); |
554 } | 554 } |
555 | 555 |
556 private: | 556 private: |
557 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 557 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
558 friend class base::DeleteHelper<ProcessSingleton::LinuxWatcher>; | 558 friend class base::DeleteHelper<ProcessSingleton::LinuxWatcher>; |
559 | 559 |
560 ~LinuxWatcher() override { | 560 ~LinuxWatcher() override { |
561 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 561 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
562 STLDeleteElements(&readers_); | 562 base::STLDeleteElements(&readers_); |
563 | 563 |
564 base::MessageLoopForIO* ml = base::MessageLoopForIO::current(); | 564 base::MessageLoopForIO* ml = base::MessageLoopForIO::current(); |
565 ml->RemoveDestructionObserver(this); | 565 ml->RemoveDestructionObserver(this); |
566 } | 566 } |
567 | 567 |
568 // Removes and deletes the SocketReader. | 568 // Removes and deletes the SocketReader. |
569 void RemoveSocketReader(SocketReader* reader); | 569 void RemoveSocketReader(SocketReader* reader); |
570 | 570 |
571 base::MessageLoopForIO::FileDescriptorWatcher fd_watcher_; | 571 base::MessageLoopForIO::FileDescriptorWatcher fd_watcher_; |
572 | 572 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 } | 1055 } |
1056 | 1056 |
1057 void ProcessSingleton::KillProcess(int pid) { | 1057 void ProcessSingleton::KillProcess(int pid) { |
1058 // TODO(james.su@gmail.com): Is SIGKILL ok? | 1058 // TODO(james.su@gmail.com): Is SIGKILL ok? |
1059 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); | 1059 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); |
1060 // ESRCH = No Such Process (can happen if the other process is already in | 1060 // ESRCH = No Such Process (can happen if the other process is already in |
1061 // progress of shutting down and finishes before we try to kill it). | 1061 // progress of shutting down and finishes before we try to kill it). |
1062 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " | 1062 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " |
1063 << base::safe_strerror(errno); | 1063 << base::safe_strerror(errno); |
1064 } | 1064 } |
OLD | NEW |