本文整理汇总了C++中PhpFile::decRef方法的典型用法代码示例。如果您正苦于以下问题:C++ PhpFile::decRef方法的具体用法?C++ PhpFile::decRef怎么用?C++ PhpFile::decRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpFile
的用法示例。
在下文中一共展示了PhpFile::decRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
PhpFile *FileRepository::checkoutFile(const string &rname,
const struct stat &s) {
PhpFile *ret = NULL;
Lock lock(s_lock);
string name;
if (rname[0] == '/') {
name = rname;
} else if (RuntimeOption::SourceRoot.empty()) {
name = Process::GetCurrentDirectory() + "/" + rname;
} else {
name = RuntimeOption::SourceRoot + "/" + rname;
}
hphp_hash_map<string, PhpFileWrapper*, string_hash>::iterator it =
s_files.find(name);
if (it == s_files.end()) {
bool created;
ret = readFile(name, s, created);
if (ret) {
s_files[name] = new PhpFileWrapper(s, ret);
ret->incRef();
if (created) {
if (RuntimeOption::SandboxCheckMd5) {
s_md5Files[ret->getMd5()] = ret;
}
} else {
if (RuntimeOption::SandboxCheckMd5) {
ASSERT(s_md5Files.find(ret->getMd5())->second == ret);
}
}
}
} else if (it->second->isChanged(s)) {
bool created;
ret = readFile(name, s, created);
if (ret) {
PhpFile *f = it->second->getPhpFile();
if (LIKELY(created)) {
assert(ret != f);
} else {
if (RuntimeOption::SandboxCheckMd5) {
ASSERT(s_md5Files.find(ret->getMd5())->second == ret);
}
}
if (LIKELY(f != ret)) {
string oldMd5 = f->getMd5();
if (f->decRef() == 0) {
onDelete(f);
}
if (RuntimeOption::SandboxCheckMd5) {
s_md5Files[ret->getMd5()] = ret;
}
delete(it->second);
it->second = new PhpFileWrapper(s, ret);
ret->incRef();
}
}
} else {
ret = it->second->getPhpFile();
}
if (ret) {
ret->incRef();
}
return ret;
}