Add multi_process_lock to base
Platform abstraction for a shared lock between processes. The process that owns the lock will release it on exit even if exit is due to a crash. For cloud-print and remoting we want to be able to have a singleton service-process that can run independently of the browser process. This service process will communicate with the browser process via the standard IAC channels, but we want to have a way of signaling to other processes that a) there is a service-process running and b) that it is in a state where it is ready to be communicated with. The multi_process_lock class is intended to work as a simple flag that can be queried from multiple processes. If the service-process should crash, we would like the flag to be cleared automatically so that there is never confusion about the state of the service-process. Other approaches considered for some Unix/Mac: - Standard unix domain sockets depend on the file system and don't clean up properly in the case of a crash. - Shared memory on unix depend on the file system and don't clean up properly in the case of a crash. - System V semaphores on unix again depend on the file system. - named_mach_ports on Mac OS. Bootstrap_register_name has been deprecated on 10.6, so we are doing essentially the same thing using CFMessagePort. On Windows it is implemented as an event. On Mac it is implemented using a CFMessagePort name. On Linux it is implement using an abstract name port socket. TEST=none BUG=none Review URL: http://codereview.chromium.org/4721001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66323 0039d316-1c4b-4281-b951-d872f2087c98
Showing
- chrome/chrome_common.gypi 4 additions, 0 deletionschrome/chrome_common.gypi
- chrome/chrome_tests.gypi 1 addition, 0 deletionschrome/chrome_tests.gypi
- chrome/common/multi_process_lock.h 39 additions, 0 deletionschrome/common/multi_process_lock.h
- chrome/common/multi_process_lock_linux.cc 95 additions, 0 deletionschrome/common/multi_process_lock_linux.cc
- chrome/common/multi_process_lock_mac.cc 54 additions, 0 deletionschrome/common/multi_process_lock_mac.cc
- chrome/common/multi_process_lock_unittest.cc 157 additions, 0 deletionschrome/common/multi_process_lock_unittest.cc
- chrome/common/multi_process_lock_win.cc 58 additions, 0 deletionschrome/common/multi_process_lock_win.cc
Loading
Please register or sign in to comment