本文整理汇总了C++中OwnArrayPtr::release方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnArrayPtr::release方法的具体用法?C++ OwnArrayPtr::release怎么用?C++ OwnArrayPtr::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnArrayPtr
的用法示例。
在下文中一共展示了OwnArrayPtr::release方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newCoordsArray
PassOwnArrayPtr<Length> newCoordsArray(const String& string, int& len)
{
unsigned length = string.length();
const UChar* data = string.characters();
StringBuffer<UChar> spacified(length);
for (unsigned i = 0; i < length; i++) {
UChar cc = data[i];
if (cc > '9' || (cc < '0' && cc != '-' && cc != '*' && cc != '.'))
spacified[i] = ' ';
else
spacified[i] = cc;
}
RefPtr<StringImpl> str = StringImpl::adopt(spacified);
str = str->simplifyWhiteSpace();
len = countCharacter(str->characters(), str->length(), ' ') + 1;
OwnArrayPtr<Length> r = adoptArrayPtr(new Length[len]);
int i = 0;
unsigned pos = 0;
size_t pos2;
while ((pos2 = str->find(' ', pos)) != notFound) {
r[i++] = parseLength(str->characters() + pos, pos2 - pos);
pos = pos2+1;
}
r[i] = parseLength(str->characters() + pos, str->length() - pos);
ASSERT(i == len - 1);
return r.release();
}
示例2: newLengthArray
PassOwnArrayPtr<Length> newLengthArray(const String& string, int& len)
{
RefPtr<StringImpl> str = string.impl()->simplifyWhiteSpace();
if (!str->length()) {
len = 1;
return nullptr;
}
len = countCharacter(str->characters(), str->length(), ',') + 1;
OwnArrayPtr<Length> r = adoptArrayPtr(new Length[len]);
int i = 0;
unsigned pos = 0;
size_t pos2;
while ((pos2 = str->find(',', pos)) != notFound) {
r[i++] = parseLength(str->characters() + pos, pos2 - pos);
pos = pos2+1;
}
ASSERT(i == len - 1);
// IE Quirk: If the last comma is the last char skip it and reduce len by one.
if (str->length()-pos > 0)
r[i] = parseLength(str->characters() + pos, str->length() - pos);
else
len--;
return r.release();
}
示例3: createValueListFromVariantArgs
static PassOwnArrayPtr<v8::Handle<v8::Value> > createValueListFromVariantArgs(const NPVariant* arguments, uint32_t argumentCount, NPObject* owner, v8::Isolate* isolate)
{
OwnArrayPtr<v8::Handle<v8::Value> > argv = adoptArrayPtr(new v8::Handle<v8::Value>[argumentCount]);
for (uint32_t index = 0; index < argumentCount; index++) {
const NPVariant* arg = &arguments[index];
argv[index] = convertNPVariantToV8Object(arg, owner, isolate);
}
return argv.release();
}
示例4: copyGlobalsFrom
void JSGlobalObject::copyGlobalsFrom(RegisterFile& registerFile)
{
ASSERT(!m_registerArray);
ASSERT(!m_registerArraySize);
int numGlobals = registerFile.numGlobals();
if (!numGlobals) {
m_registers = 0;
return;
}
OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData(), reinterpret_cast<WriteBarrier<Unknown>*>(registerFile.lastGlobal()), numGlobals, numGlobals);
WriteBarrier<Unknown>* registers = registerArray.get() + numGlobals;
setRegisters(registers, registerArray.release(), numGlobals);
}
示例5: performMatch
/*
To facilitate result caching, exec(), test(), match(), search(), and replace() dipatch regular
expression matching through the performMatch function. We use cached results to calculate,
e.g., RegExp.lastMatch and RegExp.leftParen.
*/
void RegExpConstructor::performMatch(RegExp* r, const UString& s, int startOffset, int& position, int& length, int** ovector)
{
OwnArrayPtr<int> tmpOvector;
position = r->match(s, startOffset, &tmpOvector);
if (ovector)
*ovector = tmpOvector.get();
if (position != -1) {
ASSERT(tmpOvector);
length = tmpOvector[1] - tmpOvector[0];
d->input = s;
d->lastInput = s;
d->lastOvector.set(tmpOvector.release());
d->lastNumSubPatterns = r->numSubpatterns();
}
}
示例6: adoptArrayPtr
bool SharedBitmap::to16bit()
{
if (m_locked)
return false;
if (is16bit())
return true;
BitmapInfo newBmpInfo = BitmapInfo::create(m_bmpInfo.size(), BitmapInfo::BitCount16);
int width = newBmpInfo.width();
int paddedWidth = newBmpInfo.paddedWidth();
int bufferSize = paddedWidth * newBmpInfo.height();
OwnArrayPtr<unsigned> newPixelData = adoptArrayPtr(new unsigned[bufferSize / 2]);
void* newPixels = newPixelData.get();
if (!newPixels)
return false;
unsigned short* p16 = static_cast<unsigned short*>(newPixels);
const unsigned* p32 = static_cast<const unsigned*>(m_pixels);
bool skips = paddedWidth != width;
const unsigned short* p16end = p16 + bufferSize;
while (p16 < p16end) {
for (unsigned short* p16lineEnd = p16 + width; p16 < p16lineEnd; )
*p16++ = convert32To16(*p32++);
if (skips)
*p16++ = 0;
}
if (m_hbitmap)
m_hbitmap = nullptr;
else
m_pixelData = newPixelData.release();
m_pixels = newPixels;
m_bmpInfo = newBmpInfo;
setHasAlpha(false);
return true;
}
示例7: resizeRegisters
void JSGlobalObject::resizeRegisters(int oldSize, int newSize)
{
ASSERT(oldSize <= newSize);
if (newSize == oldSize)
return;
ASSERT(newSize && newSize > oldSize);
if (m_registerArray || !m_registers) {
ASSERT(static_cast<size_t>(oldSize) == m_registerArraySize);
OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);
for (int i = 0; i < oldSize; i++)
registerArray[newSize - oldSize + i].set(globalData(), this, m_registerArray[i].get());
WriteBarrier<Unknown>* registers = registerArray.get() + newSize;
setRegisters(registers, registerArray.release(), newSize);
} else {
ASSERT(static_cast<size_t>(newSize) < globalData().interpreter->registerFile().maxGlobals());
globalData().interpreter->registerFile().setNumGlobals(newSize);
}
for (int i = -newSize; i < -oldSize; ++i)
m_registers[i].setUndefined();
}
示例8: adoptRef
// static
PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow* hostWindow, CreationFlags flags)
{
GraphicsContext3D::Attributes attr;
attr.depth = false;
attr.stencil = true;
attr.antialias = useLoopBlinnForPathRendering();
attr.canRecoverFromContextLoss = false; // Canvas contexts can not handle lost contexts.
RefPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow);
if (!context)
return 0;
OwnPtr<SolidFillShader> solidFillShader = SolidFillShader::create(context.get());
if (!solidFillShader)
return 0;
OwnPtr<TexShader> texShader = TexShader::create(context.get());
if (!texShader)
return 0;
OwnPtr<BicubicShader> bicubicShader = BicubicShader::create(context.get());
if (!bicubicShader)
return 0;
OwnArrayPtr<OwnPtr<ConvolutionShader> > convolutionShaders = adoptArrayPtr(new OwnPtr<ConvolutionShader>[cMaxKernelWidth]);
for (int i = 0; i < cMaxKernelWidth; ++i) {
convolutionShaders[i] = ConvolutionShader::create(context.get(), i + 1);
if (!convolutionShaders[i])
return 0;
}
return adoptRef(new SharedGraphicsContext3D(context.release(), solidFillShader.release(), texShader.release(), bicubicShader.release(), convolutionShaders.release(), flags));
}