Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: chrome/common/multi_process_lock_win.cc

Issue 8477018: Pull back some CHECK calls which were removed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment tweak Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/multi_process_lock_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/win/scoped_handle.h" 9 #include "base/win/scoped_handle.h"
10 10
11 class MultiProcessLockWin : public MultiProcessLock { 11 class MultiProcessLockWin : public MultiProcessLock {
12 public: 12 public:
13 explicit MultiProcessLockWin(const std::string& name) : name_(name) { } 13 explicit MultiProcessLockWin(const std::string& name) : name_(name) { }
14 14
15 virtual ~MultiProcessLockWin() { 15 virtual ~MultiProcessLockWin() {
16 if (event_.Get() != NULL) { 16 if (event_.Get() != NULL) {
17 Unlock(); 17 Unlock();
18 } 18 }
19 } 19 }
20 20
21 virtual bool TryLock() { 21 virtual bool TryLock() {
22 if (event_.Get() != NULL) { 22 if (event_.Get() != NULL) {
23 DLOG(ERROR) << "MultiProcessLock is already locked - " << name_; 23 DLOG(ERROR) << "MultiProcessLock is already locked - " << name_;
24 return true; 24 return true;
25 } 25 }
26 26
27 if (name_.length() > MULTI_PROCESS_LOCK_NAME_MAX_LEN) { 27 if (name_.length() > MULTI_PROCESS_LOCK_NAME_MAX_LEN) {
28 DLOG(ERROR) << "Socket name too long (" << name_.length() 28 LOG(ERROR) << "Socket name too long (" << name_.length()
29 << " > " << MULTI_PROCESS_LOCK_NAME_MAX_LEN << ") - " 29 << " > " << MULTI_PROCESS_LOCK_NAME_MAX_LEN << ") - " << name_;
30 << name_;
31 return false; 30 return false;
32 } 31 }
33 32
34 string16 wname = UTF8ToUTF16(name_); 33 string16 wname = UTF8ToUTF16(name_);
35 event_.Set(CreateEvent(NULL, FALSE, FALSE, wname.c_str())); 34 event_.Set(CreateEvent(NULL, FALSE, FALSE, wname.c_str()));
36 if (event_.Get() && GetLastError() != ERROR_ALREADY_EXISTS) { 35 if (event_.Get() && GetLastError() != ERROR_ALREADY_EXISTS) {
37 return true; 36 return true;
38 } else { 37 } else {
39 event_.Set(NULL); 38 event_.Set(NULL);
40 return false; 39 return false;
(...skipping 10 matching lines...) Expand all
51 50
52 private: 51 private:
53 std::string name_; 52 std::string name_;
54 base::win::ScopedHandle event_; 53 base::win::ScopedHandle event_;
55 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockWin); 54 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockWin);
56 }; 55 };
57 56
58 MultiProcessLock* MultiProcessLock::Create(const std::string &name) { 57 MultiProcessLock* MultiProcessLock::Create(const std::string &name) {
59 return new MultiProcessLockWin(name); 58 return new MultiProcessLockWin(name);
60 } 59 }
OLDNEW
« no previous file with comments | « chrome/common/multi_process_lock_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698