Exemplo n.º 1
0
std::unique_ptr<IOSurface> IOSurfacePool::takeSurface(IntSize size, CGColorSpaceRef colorSpace, IOSurface::Format format)
{
    CachedSurfaceMap::iterator mapIter = m_cachedSurfaces.find(size);

    if (mapIter == m_cachedSurfaces.end()) {
        DUMP_POOL_STATISTICS();
        return nullptr;
    }

    for (auto surfaceIter = mapIter->value.begin(); surfaceIter != mapIter->value.end(); ++surfaceIter) {
        if (!surfaceMatchesParameters(*surfaceIter->get(), size, colorSpace, format))
            continue;

        auto surface = WTFMove(*surfaceIter);
        mapIter->value.remove(surfaceIter);

        didUseSurfaceOfSize(size);

        if (mapIter->value.isEmpty()) {
            m_cachedSurfaces.remove(mapIter);
            m_sizesInPruneOrder.removeLast();
        }

        didRemoveSurface(*surface, false);

        surface->setIsVolatile(false);

        DUMP_POOL_STATISTICS();
        return surface;
    }

    // Some of the in-use surfaces may no longer actually be in-use, but we haven't moved them over yet.
    for (auto surfaceIter = m_inUseSurfaces.begin(); surfaceIter != m_inUseSurfaces.end(); ++surfaceIter) {
        if (!surfaceMatchesParameters(*surfaceIter->get(), size, colorSpace, format))
            continue;
        if (surfaceIter->get()->isInUse())
            continue;
        
        auto surface = WTFMove(*surfaceIter);
        m_inUseSurfaces.remove(surfaceIter);
        didRemoveSurface(*surface, true);

        surface->setIsVolatile(false);

        DUMP_POOL_STATISTICS();
        return surface;
    }

    DUMP_POOL_STATISTICS();
    return nullptr;
}
Exemplo n.º 2
0
///////////////////////////////////////////////////////////////////////////
//
// Methods for class ComTdbProcessInMemoryTable
//
///////////////////////////////////////////////////////////////////////////
ComTdbProcessInMemoryTable::ComTdbProcessInMemoryTable
(char * query,
 ULng32 querylen,
 Int16 querycharset,
 char * objName,
 ULng32 objNameLen,
 NABoolean isCreate,
 NABoolean isVolatile,
 NABoolean isTable,
 NABoolean isIndex,
 NABoolean isMV,
 char * schemaName,
 ULng32 schemaNameLen,
 ex_expr * input_expr,
 ULng32 input_rowlen,
 ex_expr * output_expr,
 ULng32 output_rowlen,
 ex_cri_desc * work_cri_desc,
 const unsigned short work_atp_index,
 ex_cri_desc * given_cri_desc,
 ex_cri_desc * returned_cri_desc,
 queue_index down,
 queue_index up,
 Lng32 num_buffers,
 ULng32 buffer_size)
    : ComTdbDDL(query, querylen, querycharset, schemaName, schemaNameLen,
                input_expr, input_rowlen,
                output_expr, output_rowlen,
                work_cri_desc, work_atp_index,
                given_cri_desc, returned_cri_desc,
                down, up,
                num_buffers, buffer_size),
      objName_(objName),
      objNameLen_(objNameLen),
      flags_(0)
{
    setIsCreate(isCreate);
    setIsVolatile(isVolatile);
    setIsTable(isTable);
    setIsIndex(isIndex);
    setIsMV(isMV);

    setNodeType(ComTdb::ex_PROCESS_INMEMORY_TABLE);
}
NAFileSet::NAFileSet(const QualifiedName & fileSetName,
		     const QualifiedName & extFileSetObj,
		     const NAString & extFileSetName,
		     enum FileOrganizationEnum org,
		     NABoolean isSystemTable,
		     Lng32 numberOfFiles,
		     Cardinality estimatedNumberOfRecords,
		     Lng32 recordLength,
		     Lng32 blockSize,
		     Int32 indexLevels,
		     const NAColumnArray & allColumns,
		     const NAColumnArray & indexKeyColumns,
		     const NAColumnArray & horizontalPartKeyColumns,
		     PartitioningFunction * forHorizontalPartitioning,
		     short keytag, 
		     Int64 redefTime,
		     NABoolean audited,
		     NABoolean auditCompressed,
		     NABoolean compressed,
		     ComCompressionType dcompressed,
		     NABoolean icompressed,
		     NABoolean buffered,
		     NABoolean clearOnPurge,
		     NABoolean packedRows,
                     NABoolean hasRemotePartition,
		     NABoolean isUniqueSecondaryIndex,
                     NABoolean isDecoupledRangePartitioned,
                     Lng32 fileCode,
		     NABoolean isVolatile,
		     NABoolean inMemObjectDefn,
                     desc_struct *keysDesc,
                     HHDFSTableStats *hHDFSTableStats,
                     Lng32 numSaltPartns,
                     NAList<HbaseCreateOption*>* hbaseCreateOptions,
                     CollHeap * h)
         : fileSetName_(fileSetName, h),
	   extFileSetObj_(extFileSetObj, h),
	   extFileSetName_(extFileSetName, h),
           fileOrganization_(org), 
	   isSystemTable_(isSystemTable),
           countOfFiles_(numberOfFiles),
	   estimatedNumberOfRecords_(estimatedNumberOfRecords),
	   recordLength_(recordLength),
	   blockSize_(blockSize),
	   indexLevels_(indexLevels),
           allColumns_(allColumns, h), 
           indexKeyColumns_(indexKeyColumns, h),
	   partitioningKeyColumns_(horizontalPartKeyColumns, h),
           partFunc_(forHorizontalPartitioning),
	   keytag_(keytag),
	   redefTime_(redefTime),
	   audited_(audited),
	   auditCompressed_(auditCompressed),
	   compressed_(compressed),
	   dcompressed_(dcompressed),
	   icompressed_(icompressed),
	   buffered_(buffered),
	   clearOnPurge_(clearOnPurge),
	   packedRows_(packedRows),
           hasRemotePartition_(hasRemotePartition),
           setupForStatement_(FALSE),
           resetAfterStatement_(FALSE),
	   bitFlags_(0),
	   keyLength_(0),
	   encodedKeyLength_(0),
           thisRemoteIndexGone_(FALSE),
           isDecoupledRangePartitioned_(isDecoupledRangePartitioned),
           fileCode_(fileCode),
           keysDesc_(keysDesc),
           hHDFSTableStats_(hHDFSTableStats),
           numSaltPartns_(numSaltPartns),
           hbaseCreateOptions_(hbaseCreateOptions),
           numMaxVersions_(1)
{
  setUniqueIndex(isUniqueSecondaryIndex);
  setIsVolatile(isVolatile);
  setInMemoryObjectDefn(inMemObjectDefn);

  if (hbaseCreateOptions_)
    {
      for (Lng32 i = 0; i < hbaseCreateOptions_->entries(); i++)
        {
          HbaseCreateOption * hco = (*hbaseCreateOptions_)[i];
          
          if (hco->key() == "MAX_VERSIONS")
            {
              numMaxVersions_ = atoInt64(hco->val().data());
            }
        }
      
    }
}