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

Side by Side Diff: base/shared_mutex_mac.cc

Issue 4721001: Add multi_process_lock to chrome/common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698