sapling/eden/fs/inodes/InodePtr-defs.h
Xavier Deguillard 34598d4337 remove dependency on glog
Summary:
The EdenFS codebase uses folly/logging/xlog to log, but we were still relying
on glog for the various CHECK macros. Since xlog also contains equivalent CHECK
macros, let's just rely on them instead.

This is mostly codemodded + arc lint + various fixes to get it compile.

Reviewed By: chadaustin

Differential Revision: D24871174

fbshipit-source-id: 4d2a691df235d6dbd0fbd8f7c19d5a956e86b31c
2020-11-10 16:31:15 -08:00

72 lines
1.6 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
/*
* This file contains definitions of a few simple and commonly called
* InodePtrImpl methods. It is useful for callers to see the definition of
* these methods so they can be inlined.
*
* This file is included automatically by InodeBase.h
*/
#include "InodePtr.h"
#include "InodeBase.h"
namespace facebook {
namespace eden {
template <typename InodeType>
InodePtrImpl<InodeType>::InodePtrImpl(
InodeType* value,
NormalIncrementEnum) noexcept
: value_(value) {
if (value_) {
value_->incrementPtrRef();
}
}
template <typename InodeType>
InodePtrImpl<InodeType>::InodePtrImpl(
InodeType* value,
LockedIncrementEnum) noexcept
: value_(value) {
// We don't check for value_ == nullptr here.
// The caller should always ensure the argument is non-null for this call.
value_->newInodeRefConstructed();
}
template <typename InodeType>
void InodePtrImpl<InodeType>::incref() {
if (value_) {
value_->incrementPtrRef();
}
}
template <typename InodeType>
void InodePtrImpl<InodeType>::decref() {
if (value_) {
value_->decrementPtrRef();
}
}
template <typename InodeType>
void InodePtrImpl<InodeType>::manualDecRef() {
XCHECK_NE(value_, nullptr);
value_->decrementPtrRef();
}
template <typename InodeType>
void InodePtrImpl<InodeType>::resetNoDecRef() {
XCHECK_NE(value_, nullptr);
value_ = nullptr;
}
} // namespace eden
} // namespace facebook