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

Side by Side Diff: chrome/browser/importer/firefox_profile_lock_posix.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « chrome/browser/importer/firefox_importer_browsertest.cc ('k') | chrome/browser/jumplist_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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/importer/firefox_profile_lock.h" 5 #include "chrome/browser/importer/firefox_profile_lock.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 old_lock_file_ = lock_file_.DirName().Append(kOldLockFileName); 71 old_lock_file_ = lock_file_.DirName().Append(kOldLockFileName);
72 lock_fd_ = open(old_lock_file_.value().c_str(), O_CREAT | O_EXCL, 0644); 72 lock_fd_ = open(old_lock_file_.value().c_str(), O_CREAT | O_EXCL, 0644);
73 } 73 }
74 } 74 }
75 75
76 void FirefoxProfileLock::Unlock() { 76 void FirefoxProfileLock::Unlock() {
77 if (!HasAcquired()) 77 if (!HasAcquired())
78 return; 78 return;
79 close(lock_fd_); 79 close(lock_fd_);
80 lock_fd_ = -1; 80 lock_fd_ = -1;
81 file_util::Delete(old_lock_file_, false); 81 base::Delete(old_lock_file_, false);
82 } 82 }
83 83
84 bool FirefoxProfileLock::HasAcquired() { 84 bool FirefoxProfileLock::HasAcquired() {
85 return (lock_fd_ >= 0); 85 return (lock_fd_ >= 0);
86 } 86 }
87 87
88 // This function tries to lock Firefox profile using fcntl(). The return 88 // This function tries to lock Firefox profile using fcntl(). The return
89 // value of this function together with HasAcquired() tells the current status 89 // value of this function together with HasAcquired() tells the current status
90 // of lock. 90 // of lock.
91 // if return == false: Another process has lock to the profile. 91 // if return == false: Another process has lock to the profile.
(...skipping 23 matching lines...) Expand all
115 lock_fd_ = -1; 115 lock_fd_ = -1;
116 if (errno == EAGAIN || errno == EACCES) 116 if (errno == EAGAIN || errno == EACCES)
117 return false; 117 return false;
118 else 118 else
119 return true; 119 return true;
120 } else { 120 } else {
121 // We have the lock. 121 // We have the lock.
122 return true; 122 return true;
123 } 123 }
124 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox_importer_browsertest.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698