| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 #include "base/base_paths.h" | 60 #include "base/base_paths.h" |
| 61 #include "base/basictypes.h" | 61 #include "base/basictypes.h" |
| 62 #include "base/bind.h" | 62 #include "base/bind.h" |
| 63 #include "base/command_line.h" | 63 #include "base/command_line.h" |
| 64 #include "base/eintr_wrapper.h" | 64 #include "base/eintr_wrapper.h" |
| 65 #include "base/file_path.h" | 65 #include "base/file_path.h" |
| 66 #include "base/file_util.h" | 66 #include "base/file_util.h" |
| 67 #include "base/logging.h" | 67 #include "base/logging.h" |
| 68 #include "base/message_loop.h" | 68 #include "base/message_loop.h" |
| 69 #include "base/message_loop_helpers.h" |
| 69 #include "base/path_service.h" | 70 #include "base/path_service.h" |
| 70 #include "base/process_util.h" | 71 #include "base/process_util.h" |
| 71 #include "base/rand_util.h" | 72 #include "base/rand_util.h" |
| 72 #include "base/safe_strerror_posix.h" | 73 #include "base/safe_strerror_posix.h" |
| 73 #include "base/stl_util.h" | 74 #include "base/stl_util.h" |
| 74 #include "base/string_number_conversions.h" | 75 #include "base/string_number_conversions.h" |
| 75 #include "base/string_split.h" | 76 #include "base/string_split.h" |
| 76 #include "base/stringprintf.h" | 77 #include "base/stringprintf.h" |
| 77 #include "base/sys_string_conversions.h" | 78 #include "base/sys_string_conversions.h" |
| 78 #include "base/threading/platform_thread.h" | 79 #include "base/threading/platform_thread.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 NOTREACHED(); | 555 NOTREACHED(); |
| 555 } | 556 } |
| 556 | 557 |
| 557 // MessageLoop::DestructionObserver | 558 // MessageLoop::DestructionObserver |
| 558 virtual void WillDestroyCurrentMessageLoop() { | 559 virtual void WillDestroyCurrentMessageLoop() { |
| 559 fd_watcher_.StopWatchingFileDescriptor(); | 560 fd_watcher_.StopWatchingFileDescriptor(); |
| 560 } | 561 } |
| 561 | 562 |
| 562 private: | 563 private: |
| 563 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 564 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 564 friend class DeleteTask<ProcessSingleton::LinuxWatcher>; | 565 friend class base::DeleteHelper<ProcessSingleton::LinuxWatcher>; |
| 565 | 566 |
| 566 virtual ~LinuxWatcher() { | 567 virtual ~LinuxWatcher() { |
| 567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 568 STLDeleteElements(&readers_); | 569 STLDeleteElements(&readers_); |
| 569 } | 570 } |
| 570 | 571 |
| 571 // Removes and deletes the SocketReader. | 572 // Removes and deletes the SocketReader. |
| 572 void RemoveSocketReader(SocketReader* reader); | 573 void RemoveSocketReader(SocketReader* reader); |
| 573 | 574 |
| 574 MessageLoopForIO::FileDescriptorWatcher fd_watcher_; | 575 MessageLoopForIO::FileDescriptorWatcher fd_watcher_; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 sock)); | 994 sock)); |
| 994 | 995 |
| 995 return true; | 996 return true; |
| 996 } | 997 } |
| 997 | 998 |
| 998 void ProcessSingleton::Cleanup() { | 999 void ProcessSingleton::Cleanup() { |
| 999 UnlinkPath(socket_path_); | 1000 UnlinkPath(socket_path_); |
| 1000 UnlinkPath(cookie_path_); | 1001 UnlinkPath(cookie_path_); |
| 1001 UnlinkPath(lock_path_); | 1002 UnlinkPath(lock_path_); |
| 1002 } | 1003 } |
| OLD | NEW |