| 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 #include "chrome/common/multi_process_lock.h" | 5 #include "chrome/common/multi_process_lock.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 7 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <string.h> |
| 8 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| 9 #include <sys/un.h> | 11 #include <sys/un.h> |
| 10 #include <unistd.h> | 12 #include <unistd.h> |
| 11 | 13 |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" |
| 14 #include "base/posix/eintr_wrapper.h" | 17 #include "base/posix/eintr_wrapper.h" |
| 15 | 18 |
| 16 class MultiProcessLockLinux : public MultiProcessLock { | 19 class MultiProcessLockLinux : public MultiProcessLock { |
| 17 public: | 20 public: |
| 18 explicit MultiProcessLockLinux(const std::string& name) | 21 explicit MultiProcessLockLinux(const std::string& name) |
| 19 : name_(name), fd_(-1) { } | 22 : name_(name), fd_(-1) { } |
| 20 | 23 |
| 21 ~MultiProcessLockLinux() override { | 24 ~MultiProcessLockLinux() override { |
| 22 if (fd_ != -1) { | 25 if (fd_ != -1) { |
| 23 Unlock(); | 26 Unlock(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 101 |
| 99 private: | 102 private: |
| 100 std::string name_; | 103 std::string name_; |
| 101 int fd_; | 104 int fd_; |
| 102 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockLinux); | 105 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockLinux); |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 MultiProcessLock* MultiProcessLock::Create(const std::string &name) { | 108 MultiProcessLock* MultiProcessLock::Create(const std::string &name) { |
| 106 return new MultiProcessLockLinux(name); | 109 return new MultiProcessLockLinux(name); |
| 107 } | 110 } |
| OLD | NEW |