本文整理汇总了C++中Space::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::size方法的具体用法?C++ Space::size怎么用?C++ Space::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: release
// release - release a MemoryRegion
void MemoryArea::release(MemoryRegion* pRegion)
{
if (NULL == pRegion)
return;
Space *space = pRegion->parent();
MemoryRegion::Destroy(pRegion);
if (0 == space->numOfRegions()) {
if (NULL != m_pFileHandle) {
// if m_pFileHandle is NULL, clients delegate us an universal Space and
// we never remove it. Otherwise, we have to synchronize and release
// Space.
if (m_pFileHandle->isWritable()) {
// synchronize writable space before we release it.
Space::Sync(space, *m_pFileHandle);
}
std::pair<SpaceMapType::iterator, SpaceMapType::iterator> range =
m_SpaceMap.equal_range(Key(space->start(), space->size()));
SpaceMapType::iterator it;
for (it = range.first; it != range.second; ++it) {
if (space == it->second)
break;
}
m_SpaceMap.erase(it);
Space::Release(space, *m_pFileHandle);
assert(NULL != space);
Space::Destroy(space);
}
}
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_compile_mclinker,代码行数:35,代码来源:MemoryArea.cpp
示例2: request
// The layout of MemorySpace in the virtual memory space
//
// | : page boundary
// [,]: MemoryRegion
// - : fillment
// = : data
//
// |---[=|====|====|==]--|
// ^ ^ ^ ^
// | | | |
// | r_start +r_len |
// space.data +space.size
//
// space.file_offset is the offset of the mapped file segment from the start of
// the file. if the MemorySpace's type is ALLOCATED_ARRAY, the distances of
// (space.data, r_start) and (r_len, space.size) are zero.
//
MemoryRegion* MemoryArea::request(size_t pOffset, size_t pLength)
{
Space* space = find(pOffset, pLength);
if (NULL == space) {
// not found
if (NULL == m_pFileHandle) {
// if m_pFileHandle is NULL, clients delegate us an universal Space and
// we never remove it. In that way, space can not be NULL.
unreachable(diag::err_out_of_range_region) << pOffset << pLength;
}
space = Space::Create(*m_pFileHandle, pOffset, pLength);
m_SpaceMap.insert(std::make_pair(Key(space->start(), space->size()), space));
}
// adjust r_start
off_t distance = pOffset - space->start();
void* r_start = space->memory() + distance;
// now, we have a legal space to hold the new MemoryRegion
return MemoryRegion::Create(r_start, pLength, *space);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_compile_mclinker,代码行数:39,代码来源:MemoryArea.cpp
示例3:
//===--------------------------------------------------------------------===//
// MemoryArea
//===--------------------------------------------------------------------===//
// MemoryArea - special constructor
// This constructor is used for *SPECIAL* situation. I'm sorry I can not
// reveal what is the special situation.
MemoryArea::MemoryArea(Space& pUniverse)
: m_pFileHandle(NULL) {
m_SpaceMap.insert(std::make_pair(Key(pUniverse.start(), pUniverse.size()),
&pUniverse));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_compile_mclinker,代码行数:11,代码来源:MemoryArea.cpp