コード例 #1
0
ファイル: documentMap.cpp プロジェクト: navyjeff/nppcr_npp
void DocumentMap::reloadMap()
{
	if (_pScintillaEditView && _ppEditView)
	{

		Document currentDoc = (*_ppEditView)->execute(SCI_GETDOCPOINTER);
		_pScintillaEditView->execute(SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc);

		//
		// sync with the current document
		//

		Buffer *editBuf = (*_ppEditView)->getCurrentBuffer();
		_pScintillaEditView->setCurrentBuffer(editBuf);

		// folding
		std::vector<HeaderLineState> lineStateVector;
		(*_ppEditView)->getCurrentFoldStates(lineStateVector);
		_pScintillaEditView->syncFoldStateWith(lineStateVector);

		// Wrapping
		if ((*_ppEditView)->isWrap() && needToRecomputeWith())
		{
			wrapMap();
		}

		scrollMap();
	}
}
コード例 #2
0
ファイル: SharedMemoryUnix.cpp プロジェクト: eocanha/webkit
RefPtr<SharedMemory> SharedMemory::map(const Handle& handle, Protection protection)
{
    ASSERT(!handle.isNull());

    int fd = handle.m_attachment.releaseFileDescriptor();
    void* data = mmap(0, handle.m_attachment.size(), accessModeMMap(protection), MAP_SHARED, fd, 0);
    closeWithRetry(fd);
    if (data == MAP_FAILED)
        return nullptr;

    RefPtr<SharedMemory> instance = wrapMap(data, handle.m_attachment.size(), -1);
    instance->m_fileDescriptor = std::nullopt;
    instance->m_isWrappingMap = false;
    return instance;
}