Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/shared_mutex.h" | |
| 6 #include "base/mac/scoped_cftyperef.h" | |
|
Mark Mentovai
2010/11/09 17:43:14
Blank line before.
dmac
2010/11/11 21:47:59
Done.
| |
| 7 #include "base/sys_string_conversions.h" | |
| 8 | |
| 9 namespace base { | |
| 10 | |
| 11 SharedMutex::SharedMutex(const std::string& name) : port_(NULL), name_(name) { | |
| 12 } | |
|
Mark Mentovai
2010/11/09 17:43:14
Blank line before, and } // namespace base.
dmac
2010/11/11 21:47:59
Sorry... what do you mean? A couple of us read you
| |
| 13 | |
| 14 bool SharedMutex::TryLock() { | |
| 15 CFStringRef cf_name(base::SysUTF8ToCFStringRef(name_)); | |
| 16 base::mac::ScopedCFTypeRef<CFStringRef> scoped_cf_name(cf_name); | |
| 17 port_ = CFMessagePortCreateLocal(NULL, | |
|
Mark Mentovai
2010/11/09 17:43:14
I’d have just thrown all of these on the same line
dmac
2010/11/11 21:47:59
Done.
| |
| 18 cf_name, | |
| 19 NULL, | |
| 20 NULL, | |
| 21 NULL); | |
| 22 return port_ != NULL; | |
| 23 } | |
| 24 | |
| 25 void SharedMutex::Unlock() { | |
| 26 if (port_) { | |
|
Mark Mentovai
2010/11/09 17:43:14
port_ could have just been a ScopedCFTypeRef.
dmac
2010/11/11 21:47:59
Done.
| |
| 27 CFRelease(port_); | |
| 28 port_ = NULL; | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 } // namespace base | |
| OLD | NEW |