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

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

Issue 8368018: Convert chrome/common non-debug logs to debug logs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/multi_process_lock_linux.cc ('k') | chrome/common/multi_process_lock_win.cc » ('j') | 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) 2010 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/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 10
11 class MultiProcessLockMac : public MultiProcessLock { 11 class MultiProcessLockMac : public MultiProcessLock {
12 public: 12 public:
13 explicit MultiProcessLockMac(const std::string& name) : name_(name) { } 13 explicit MultiProcessLockMac(const std::string& name) : name_(name) { }
14 14
15 virtual ~MultiProcessLockMac() { 15 virtual ~MultiProcessLockMac() {
16 if (port_ != NULL) { 16 if (port_ != NULL) {
17 Unlock(); 17 Unlock();
18 } 18 }
19 } 19 }
20 20
21 virtual bool TryLock() { 21 virtual bool TryLock() {
22 if (port_ != NULL) { 22 if (port_ != 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 LOG(ERROR) << "Socket name too long (" << name_.length() 28 DLOG(ERROR) << "Socket name too long (" << name_.length()
29 << " > " << MULTI_PROCESS_LOCK_NAME_MAX_LEN << ") - " << name_; 29 << " > " << MULTI_PROCESS_LOCK_NAME_MAX_LEN << ") - "
30 << name_;
30 return false; 31 return false;
31 } 32 }
32 33
33 CFStringRef cf_name(base::SysUTF8ToCFStringRef(name_)); 34 CFStringRef cf_name(base::SysUTF8ToCFStringRef(name_));
34 base::mac::ScopedCFTypeRef<CFStringRef> scoped_cf_name(cf_name); 35 base::mac::ScopedCFTypeRef<CFStringRef> scoped_cf_name(cf_name);
35 port_.reset(CFMessagePortCreateLocal(NULL, cf_name, NULL, NULL, NULL)); 36 port_.reset(CFMessagePortCreateLocal(NULL, cf_name, NULL, NULL, NULL));
36 return port_ != NULL; 37 return port_ != NULL;
37 } 38 }
38 39
39 virtual void Unlock() { 40 virtual void Unlock() {
40 if (port_ == NULL) { 41 if (port_ == NULL) {
41 DLOG(ERROR) << "Over-unlocked MultiProcessLock - " << name_; 42 DLOG(ERROR) << "Over-unlocked MultiProcessLock - " << name_;
42 return; 43 return;
43 } 44 }
44 port_.reset(); 45 port_.reset();
45 } 46 }
46 47
47 private: 48 private:
48 std::string name_; 49 std::string name_;
49 base::mac::ScopedCFTypeRef<CFMessagePortRef> port_; 50 base::mac::ScopedCFTypeRef<CFMessagePortRef> port_;
50 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockMac); 51 DISALLOW_COPY_AND_ASSIGN(MultiProcessLockMac);
51 }; 52 };
52 53
53 MultiProcessLock* MultiProcessLock::Create(const std::string &name) { 54 MultiProcessLock* MultiProcessLock::Create(const std::string &name) {
54 return new MultiProcessLockMac(name); 55 return new MultiProcessLockMac(name);
55 } 56 }
OLDNEW
« no previous file with comments | « chrome/common/multi_process_lock_linux.cc ('k') | chrome/common/multi_process_lock_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698