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

Side by Side Diff: rlz/mac/lib/rlz_value_store_mac.mm

Issue 12217101: Replace FilePath with base::FilePath in some more top level directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 | « rlz/lib/recursive_cross_process_lock_posix.cc ('k') | rlz/test/rlz_test_helpers.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "rlz/mac/lib/rlz_value_store_mac.h" 5 #include "rlz/mac/lib/rlz_value_store_mac.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // path if it doesn't exist. 268 // path if it doesn't exist.
269 NSString* RlzLockFilename() { 269 NSString* RlzLockFilename() {
270 NSString* const kRlzLockfile = @"flockfile"; 270 NSString* const kRlzLockfile = @"flockfile";
271 return [CreateRlzDirectory() stringByAppendingPathComponent:kRlzLockfile]; 271 return [CreateRlzDirectory() stringByAppendingPathComponent:kRlzLockfile];
272 } 272 }
273 273
274 } // namespace 274 } // namespace
275 275
276 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() { 276 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() {
277 bool got_distributed_lock = g_recursive_lock.TryGetCrossProcessLock( 277 bool got_distributed_lock = g_recursive_lock.TryGetCrossProcessLock(
278 FilePath([RlzLockFilename() fileSystemRepresentation])); 278 base::FilePath([RlzLockFilename() fileSystemRepresentation]));
279 // At this point, we hold the in-process lock, no matter the value of 279 // At this point, we hold the in-process lock, no matter the value of
280 // |got_distributed_lock|. 280 // |got_distributed_lock|.
281 281
282 ++g_lock_depth; 282 ++g_lock_depth;
283 283
284 if (!got_distributed_lock) { 284 if (!got_distributed_lock) {
285 // Give up. |store_| isn't set, which signals to callers that acquiring 285 // Give up. |store_| isn't set, which signals to callers that acquiring
286 // the lock failed. |g_recursive_lock| will be released by the 286 // the lock failed. |g_recursive_lock| will be released by the
287 // destructor. 287 // destructor.
288 CHECK(!g_store_object); 288 CHECK(!g_store_object);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 g_recursive_lock.ReleaseLock(); 343 g_recursive_lock.ReleaseLock();
344 } 344 }
345 345
346 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { 346 RlzValueStore* ScopedRlzValueStoreLock::GetStore() {
347 return store_.get(); 347 return store_.get();
348 } 348 }
349 349
350 namespace testing { 350 namespace testing {
351 351
352 void SetRlzStoreDirectory(const FilePath& directory) { 352 void SetRlzStoreDirectory(const base::FilePath& directory) {
353 base::mac::ScopedNSAutoreleasePool pool; 353 base::mac::ScopedNSAutoreleasePool pool;
354 354
355 [g_test_folder release]; 355 [g_test_folder release];
356 if (directory.empty()) { 356 if (directory.empty()) {
357 g_test_folder = nil; 357 g_test_folder = nil;
358 } else { 358 } else {
359 // Not Unsafe on OS X. 359 // Not Unsafe on OS X.
360 g_test_folder = 360 g_test_folder =
361 [[NSString alloc] initWithUTF8String:directory.AsUTF8Unsafe().c_str()]; 361 [[NSString alloc] initWithUTF8String:directory.AsUTF8Unsafe().c_str()];
362 } 362 }
363 } 363 }
364 364
365 std::string RlzStoreFilenameStr() { 365 std::string RlzStoreFilenameStr() {
366 @autoreleasepool { 366 @autoreleasepool {
367 return std::string([RlzPlistFilename() fileSystemRepresentation]); 367 return std::string([RlzPlistFilename() fileSystemRepresentation]);
368 } 368 }
369 } 369 }
370 370
371 } // namespace testing 371 } // namespace testing
372 372
373 } // namespace rlz_lib 373 } // namespace rlz_lib
OLDNEW
« no previous file with comments | « rlz/lib/recursive_cross_process_lock_posix.cc ('k') | rlz/test/rlz_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698