1 // Copyright (c) 2006-2008 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 "net/disk_cache/file_lock.h" 6 7 namespace disk_cache { 8 FileLock(BlockFileHeader * header)9FileLock::FileLock(BlockFileHeader* header) { 10 updating_ = &header->updating; 11 (*updating_)++; 12 acquired_ = true; 13 } 14 Lock()15void FileLock::Lock() { 16 if (acquired_) 17 return; 18 (*updating_)++; 19 } 20 Unlock()21void FileLock::Unlock() { 22 if (!acquired_) 23 return; 24 (*updating_)--; 25 } 26 27 } // namespace disk_cache 28