예제 #1
0
////////////////////////////////////////////////////////////////
// CStream::ReadBytes
//
/////////////////////////////////////////////////////////////////
HRESULT CStream::ReadBytes(REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, DBLENGTH cbMaxSize, void* pBuffer, DBLENGTH* pcbRead)
{
	HRESULT hr = S_OK;
	BOOL	bUseDefault = FALSE;

	ULONG	cbRead = 0;
	cBytes = min(cBytes, cbMaxSize);
	
	//Determine object type
	if(riid != IID_ISequentialStream && riid != IID_ILockBytes && riid != IID_IStream)
		bUseDefault = TRUE;
	
	//IID_ISequentialStream
	if((riid == IID_ISequentialStream && m_pISequentialStream) || (bUseDefault && m_pISequentialStream))
	{
		//ISequentialStream::Read
		//TODO64:  I*::Read only takes a ULONG
		//NOTE: ::Read can post errorinfo objects in the case of warnings.  SQLOLEDB's XML Stream
		//object will post execution errors on the last read...
		XTEST_(hr = m_pISequentialStream->Read(pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
		TESTC(TRACE_METHOD(hr, L"ISequentialStream::Read(0x%p, %d, &%d)", pBuffer, cBytes, cbRead));
	}
	//IID_ILockBytes
	else if((riid == IID_ILockBytes && m_pILockBytes) || (bUseDefault && m_pILockBytes))
	{
		ULARGE_INTEGER ulgOffset;
		ulgOffset.QuadPart = ulOffset;
		
		//ILockBytes::ReadAt
		//TODO64:  I*::Read only takes a ULONG
		XTEST_(hr = m_pILockBytes->ReadAt(ulgOffset, pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
		TESTC(TRACE_METHOD(hr, L"ILockBytes::ReadAt(%d, 0x%p, %d, &%d)", ulOffset, pBuffer, cBytes, cbRead));
	}
	//IID_IStream
	else if((riid == IID_IStream && m_pIStream) || (bUseDefault && m_pIStream))
	{
		//IStream::Read
		//TODO64:  I*::Read only takes a ULONG
		XTEST_(hr = m_pIStream->Read(pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
		TESTC(TRACE_METHOD(hr, L"IStream::Read(0x%p, %d, &%d)", pBuffer, cBytes, cbRead));
	}
//	else if(m_pIStorage)
//	{
		//TODO
//	}
	else
	{
		TESTC(hr = E_FAIL);
	}

CLEANUP:
	if(pcbRead)
		*pcbRead = cbRead;
	return hr;
}
예제 #2
0
////////////////////////////////////////////////////////////////
// CStream::WriteBytes
//
/////////////////////////////////////////////////////////////////
HRESULT CStream::WriteBytes(REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, void* pBuffer, DBLENGTH* pcbWritten)
{
	HRESULT hr = S_OK;
	BOOL	bUseDefault = FALSE;
	ULONG	cbWritten = 0;

	//Determine object type
	if(riid != IID_ISequentialStream && riid != IID_ILockBytes && riid != IID_IStream)
		bUseDefault = TRUE;
	
	//IID_ISequentialStream
	if((riid == IID_ISequentialStream && m_pISequentialStream) || (bUseDefault && m_pISequentialStream))
	{
		//ISequentialStream::Write
		//TODO64:  I*::Write only takes a ULONG
		XTEST(hr = m_pISequentialStream->Write(pBuffer, (ULONG)cBytes, &cbWritten));
		TESTC(TRACE_METHOD(hr, L"ISequentialStream::Write(0x%p, %d, &%d)", pBuffer, cBytes, cbWritten));
	}
	//IID_ILockBytes
	else if((riid == IID_ILockBytes && m_pILockBytes) || (bUseDefault && m_pILockBytes))
	{
		ULARGE_INTEGER ulgOffset;
		ulgOffset.QuadPart = ulOffset;
		
		//ILockBytes::WriteAt
		//TODO64:  I*::Write only takes a ULONG
		XTEST(hr = m_pILockBytes->WriteAt(ulgOffset, pBuffer, (ULONG)cBytes, &cbWritten));
		TESTC(TRACE_METHOD(hr, L"ILockBytes::WriteAt(%d, 0x%p, %d, &%d)", ulOffset, pBuffer, cBytes, cbWritten));
	}
	//IID_IStream
	else if((riid == IID_IStream && m_pIStream) || (bUseDefault && m_pIStream))
	{
		//IStream::Write
		//TODO64:  I*::Write only takes a ULONG
		XTEST(hr = m_pIStream->Write(pBuffer, (ULONG)cBytes, &cbWritten));
		TESTC(TRACE_METHOD(hr, L"IStream::Write(0x%p, %d, &%d)", pBuffer, cBytes, cbWritten));
	}
//	else if(m_pIStorage)
//	{
		//TODO
//	}
	else
	{
		TESTC(hr = E_FAIL);
	}

CLEANUP:
	if(pcbWritten)
		*pcbWritten = cbWritten;
	return hr;
}
예제 #3
0
// Constructor
CControlSite::CControlSite()
{
    TRACE_METHOD(CControlSite::CControlSite);

    m_hWndParent = NULL;
    m_CLSID = CLSID_NULL;
    m_bSetClientSiteFirst = FALSE;
    m_bVisibleAtRuntime = TRUE;
    memset(&m_rcObjectPos, 0, sizeof(m_rcObjectPos));

    m_bInPlaceActive = FALSE;
    m_bUIActive = FALSE;
    m_bInPlaceLocked = FALSE;
    m_bWindowless = FALSE;
    m_bSupportWindowlessActivation = TRUE;
    m_bSafeForScriptingObjectsOnly = FALSE;
    m_pSecurityPolicy = GetDefaultControlSecurityPolicy();

    // Initialise ambient properties
    m_nAmbientLocale = 0;
    m_clrAmbientForeColor = ::GetSysColor(COLOR_WINDOWTEXT);
    m_clrAmbientBackColor = ::GetSysColor(COLOR_WINDOW);
    m_bAmbientUserMode = true;
    m_bAmbientShowHatching = true;
    m_bAmbientShowGrabHandles = true;
    m_bAmbientAppearance = true; // 3d

    // Windowless variables
    m_hDCBuffer = NULL;
    m_hRgnBuffer = NULL;
    m_hBMBufferOld = NULL;
    m_hBMBuffer = NULL;
}
void BaseLayerAndroid::updatePositionsRecursive(const SkRect& visibleContentRect)
{
    TRACE_METHOD();

    updateLayerPositions(visibleContentRect);
    TransformationMatrix ident;

    // Start with an unnecessarily large clip, since the base layer can
    // dynamically increase in size to cover the viewport, and we cache its draw
    // clip. This way the base layer will never have it's visible area clipped
    // by its m_clippingRect, only the viewport.
    // Note: values larger than this suffer from floating point rounding issues
    FloatRect clip(0, 0, 1e7, 1e7);

    bool forcePositionCalculation = !m_positionsCalculated;
    float scale = 1.0f;
    // To minimize tearing in single surface mode, don't update the fixed element
    // when scrolling. The fixed element will move incorrectly when scrolling,
    // but its position will be corrected after scrolling.
    bool disableFixedElemUpdate = false;
    GLWebViewState* webViewState = state();
    if (webViewState) {
        scale = webViewState->scale();
        disableFixedElemUpdate = webViewState->isScrolling()
                                 && webViewState->isSingleSurfaceRenderingMode();
    }
    updateGLPositionsAndScale(ident, clip, 1, scale, forcePositionCalculation,
                              disableFixedElemUpdate);

    m_positionsCalculated = true;
}
예제 #5
0
// Unhook the control from the window and throw it all away
HRESULT CControlSite::Detach()
{
    TRACE_METHOD(CControlSite::Detach);

    if (m_spIOleInPlaceObjectWindowless)
    {
        m_spIOleInPlaceObjectWindowless.Release();
    }

    if (m_spIOleInPlaceObject)
    {
        m_spIOleInPlaceObject->InPlaceDeactivate();
        m_spIOleInPlaceObject.Release();
    }

    if (m_spIOleObject)
    {
        m_spIOleObject->Close(OLECLOSE_NOSAVE);
        m_spIOleObject->SetClientSite(NULL);
        m_spIOleObject.Release();
    }

    m_spIViewObject.Release();
    m_spObject.Release();
    
    return S_OK;
}
예제 #6
0
/////////////////////////////////////////////////////////////////
// HRESULT CAsynchBase::Initialize
//
/////////////////////////////////////////////////////////////////
HRESULT CAsynchBase::Initialize()
{
	HRESULT	hr = S_OK;
	DWORD dwCreateOpts = GetOptions()->m_dwCreateOpts;

	if(!m_pIDBInitialize)
		goto CLEANUP;

	//Initailize
	//NOTE: Expect S_OK or DB_E_CANCELED, since canceling the dialog always returns DB_E_CANCELED
	XTEST_(hr = m_pIDBInitialize->Initialize(), DB_E_CANCELED);
	TRACE_METHOD(hr, L"IDBInitialize::Initialize()");

	//Display any property errors...
	TESTC(hr = DisplayPropErrors(hr, IID_IDBProperties, m_pIDBInitialize));

	//We are now Initialized
	m_fInitialized = TRUE;

	//Obtain all interfaces, now that we are initialized
	TESTC(hr = AutoQI(dwCreateOpts));
	
	//Also "redraw" the object now that more interfaces are available for use
	//For Example: If the rowset was originally obtained Asynchronously and now interfaces
	//to obtain columns and data are available, display the object...
	TESTC(hr = DisplayObject());

CLEANUP:
	return hr;
}
/////////////////////////////////////////////////////////////////
// HRESULT CDataSource::AdminCreateDataSource
//
/////////////////////////////////////////////////////////////////
HRESULT CDataSource::AdminCreateDataSource(CAggregate* pCAggregate, ULONG cPropSets, DBPROPSET* rgPropSets, REFIID riid, IUnknown** ppIUnknown)
{
	HRESULT	hr = S_OK;
	DWORD dwCreateOpts = GetOptions()->m_dwCreateOpts;

	if(m_pIDBDataSourceAdmin)
	{
		//IDBDataSourceAdmin::CreateDataSource
		XTEST(hr = m_pIDBDataSourceAdmin->CreateDataSource(cPropSets, rgPropSets, pCAggregate, riid, ppIUnknown));
		TRACE_METHOD(hr, L"IDBDataSourceAdmin::CreateDataSource(%d, 0x%p, 0x%p, %s, &0x%p)", cPropSets, rgPropSets, pCAggregate, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL);

		//Display any property errors...
		TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

		//Handle Aggregation
		if(pCAggregate)
			pCAggregate->HandleAggregation(riid, ppIUnknown);
		
		//We are now Initialized
		m_fInitialized = TRUE;

		//Obtain all interfaces, now that we are initialized
		TESTC(hr = AutoQI(dwCreateOpts));
	}
	
CLEANUP:
	return hr;
}
예제 #8
0
HRESULT CStorageBuffer::SetSize(	ULARGE_INTEGER libNewSize)		//Specifies the new size of the stream object
{
	HRESULT hr = STG_E_MEDIUMFULL;
	void* pBuffer = m_pBuffer;

	//The value of the libNewSize parameter is not valid. 
	//Since streams cannot be greater than 2^32 bytes in the COM-provided 
	//implementation, the high DWORD of libNewSize must be 0. 
	//If it is nonzero, this parameter is not valid. 
	if(libNewSize.QuadPart > ULONG_MAX)
	{
		hr = STG_E_INVALIDFUNCTION;
		goto CLEANUP;
	}
	
	//Use a copy variable, incase allocations fail...
	SAFE_REALLOC(pBuffer, BYTE, libNewSize.QuadPart);

	m_pBuffer = pBuffer;
	m_cMaxSize = (ULONG)libNewSize.QuadPart;
	hr = S_OK;

CLEANUP:
	TRACE_METHOD(hr, L"\tIStream::SetSize(%d)", (ULONG)libNewSize.QuadPart);
	return hr;
}
예제 #9
0
/////////////////////////////////////////////////////////////////
// HRESULT CRow::OpenRowset
//
/////////////////////////////////////////////////////////////////
HRESULT CRow::OpenRowset(CAggregate* pCAggregate, DBID* pTableID, DBID* pIndexID, REFIID riid, ULONG cPropSets, DBPROPSET* rgPropSets, IUnknown** ppIUnknown)
{
	HRESULT				hr = E_FAIL;			// HRESULT

	if(!m_pIScopedOperations)
		return E_FAIL;

	WCHAR wszTableName[MAX_QUERY_LEN+1];
	WCHAR wszIndexName[MAX_QUERY_LEN+1];

	// From IOpenRowset, get a rowset object
	DBIDToString(pTableID, wszTableName, MAX_QUERY_LEN);
	DBIDToString(pIndexID, wszIndexName, MAX_QUERY_LEN);
				
	XTEST_(hr = m_pIScopedOperations->OpenRowset(
							pCAggregate,		// pUnkOuter
							pTableID,			// pTableID
							pIndexID,			// pIndexID
							riid,				// refiid
							cPropSets,			// cProperties
							rgPropSets,			// rgProperties
							ppIUnknown),S_OK);	// IRowset pointer
	TRACE_METHOD(hr, L"IScopedOperations::OpenRowset(0x%p, %s, %s, %s, %d, 0x%p, &0x%p)", pCAggregate, wszTableName, wszIndexName, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);

	//Display Errors (if occurred)
	TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

	//Handle Aggregation
	if(pCAggregate)
		TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
	return hr;    
}
void RasterRenderer::setupCanvas(const TileRenderInfo& renderInfo, SkCanvas* canvas)
{
    TRACE_METHOD();

    if (renderInfo.baseTile->isLayerTile()) {
        m_bitmap.setAlphaType(kPremul_SkAlphaType);

        // clear bitmap if necessary
        if (!m_bitmapIsPureColor || m_bitmapPureColor != Color::transparent)
            m_bitmap.eraseARGB(0, 0, 0, 0);
    } else {
        Color defaultBackground = Color::white;
        Color* background = renderInfo.tilePainter->background();
        if (!background) {
            ALOGV("No background color for base layer!");
            background = &defaultBackground;
        }
        ALOGV("setupCanvas use background on Base Layer %x", background->rgb());
        m_bitmap.setAlphaType(background->hasAlpha() ? kPremul_SkAlphaType : kOpaque_SkAlphaType);

        // fill background color if necessary
        if (!m_bitmapIsPureColor || m_bitmapPureColor != *background)
            m_bitmap.eraseARGB(background->alpha(), background->red(),
                               background->green(), background->blue());
    }

    SkBitmapDevice* device = new SkBitmapDevice(m_bitmap);

    canvas->setDevice(device);

    device->unref();
}
예제 #11
0
/////////////////////////////////////////////////////////////////
// HRESULT CDataset::GetCellData
//
/////////////////////////////////////////////////////////////////
HRESULT CDataset::GetCellData(DBORDINAL ulStartCell, DBORDINAL ulEndCell)
{
	HRESULT hr = E_FAIL;
	
	if(m_pIMDDataset)
	{
		//NOTE: Using cbRowSize of IAccessor::CreateAccessor
		//Because this method fetches properties for more than one cell, 
		//the provider should know how long each row is. In this context, a "row" means the area 
		//allocated in the consumer's buffer to hold all properties pertaining to one cell. 
		//This information should be given in the cbRowSize parameter of IAccessor::CreateAccessor. 
		//If the value of this parameter is zero, the consumer wants to fetch only one row of data 
		//(one cell). In this case, it is an error to specify a ulStartCell different from the 
		//ulEndCell.
		
		//Because of the above in the OLAP spec, we need to make sure our buffer is large enough
		//to hold the number of requested cells...
		if(ulEndCell > ulStartCell && m_cbRowSize)
			SAFE_REALLOC(m_pData, BYTE, m_cbRowSize * (ulEndCell - ulStartCell + 1));

		//IMDDataset::GetCellData
		XTEST(hr = m_pIMDDataset->GetCellData(m_hAccessor, ulStartCell, ulEndCell, m_pData));
		TESTC(TRACE_METHOD(hr, L"IMDDataset::GetCellData(0x%p, 0x%Id, 0x%Id, 0x%p)", m_hAccessor, ulStartCell, ulEndCell, m_pData));
 	}

CLEANUP:
	return hr;
}
예제 #12
0
////////////////////////////////////////////////////////////////
//	GetAxisRowset
//
//	Get the axis info and rowset for the first axis.
//	Return IRowset interface for the axis rowset.
//
/////////////////////////////////////////////////////////////////
HRESULT	CDataset::GetAxisRowset(CAggregate* pCAggregate, DBCOUNTITEM iAxis, REFIID riid, ULONG cPropSets, DBPROPSET* rgPropSets, IUnknown** ppIUnknown)
{
	HRESULT hr = E_FAIL;

	if(m_pIMDDataset)
	{
		//GetAxisInfo (if not already)
		if(m_cAxis == 0)
			TESTC(hr = GetAxisInfo(&m_cAxis, &m_rgAxisInfo));
			
		//GetAxisRowset
		if(m_cAxis)
		{
			XTEST_(hr = m_pIMDDataset->GetAxisRowset(
											pCAggregate, 
											iAxis, 
											riid, 
											cPropSets, 
											rgPropSets, 
											ppIUnknown),S_OK);
			TRACE_METHOD(hr, L"IMDDataset::GetAxisRowset(0x%p, %d, %s, %d, 0x%p, &0x%p)", pCAggregate, iAxis, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);
		}

		//Display Errors (if occurred)
		TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

		//Handle Aggregation
		if(pCAggregate)
			TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
	}

CLEANUP:
	return hr;    
}
예제 #13
0
ImageTexture* ImagesManager::setImage(SkBitmapRef* imgRef)
{
    if (!imgRef)
        return 0;

    TRACE_METHOD();
    SkBitmap* bitmap = &imgRef->bitmap();
    ImageTexture* image = 0;
    SkBitmap* img = 0;
    unsigned crc = 0;

    crc = ImageTexture::computeCRC(bitmap);

    {
        android::Mutex::Autolock lock(m_imagesLock);
        if (m_images.contains(crc)) {
            image = m_images.get(crc);
            SkSafeRef(image);
            return image;
        }
    }

    // the image is not in the map, we add it

    img = ImageTexture::convertBitmap(bitmap);
    image = new ImageTexture(img, crc);

    android::Mutex::Autolock lock(m_imagesLock);
    m_images.set(crc, image);

    return image;
}
void SurfaceCollection::swapTiles()
{
    bool calculateFrameworkInvals = !m_compositedRoot->state()->inUnclippedDraw();

    TRACE_METHOD();
    for (unsigned int i = 0; i < m_surfaces.size(); i++)
         m_surfaces[i]->swapTiles(calculateFrameworkInvals);
}
예제 #15
0
HRESULT CStorageBuffer::CopyTo(	IStream * pIStream,				//Points to the destination stream
							ULARGE_INTEGER cb,				//Specifies the number of bytes to copy
							ULARGE_INTEGER * pcbRead,		//Pointer to the actual number of bytes read from the source
							ULARGE_INTEGER * pcbWritten)	//Pointer to the actual number of bytes written to the destination
{
	HRESULT hr = S_OK;

	//This is equivlent of doing Read from our stream then Write into the destination.
	//It also moves the seek position.  Bug this would require allocating a temp buffer...
	//Just access our stream directly...
	
	//Parameter checking
	if(pcbRead)
		pcbRead->QuadPart = 0;
	if(pcbWritten)
		pcbWritten->QuadPart = 0;

	//Actual code
	ULONG cBytesLeft = m_cMaxSize - m_iPos;
	ULONG cBytesRead = (ULONG)cb.QuadPart > cBytesLeft ? cBytesLeft : (ULONG)cb.QuadPart;
	ULONG cBytesWritten = 0;

	if(!pIStream)
	{
		hr = STG_E_INVALIDPOINTER;
		goto CLEANUP;
	}

	if(cb.QuadPart == 0)
	{
		hr = S_OK;
		goto CLEANUP;
	}

	//if no more bytes to retrive return 
	if(cBytesLeft == 0)
	{
		hr = S_FALSE; 
		goto CLEANUP;
	}

	//Copy to users buffer the number of bytes requested or remaining
	pIStream->Write((BYTE*)m_pBuffer + m_iPos, cBytesRead, &cBytesWritten);
	m_iPos += cBytesRead;

	if(pcbRead)
		pcbRead->QuadPart = cBytesRead;
	if(pcbWritten)
		pcbWritten->QuadPart = cBytesWritten;

	if(cb.QuadPart != cBytesRead)
		hr = S_FALSE; 

CLEANUP:
	TRACE_METHOD(hr, L"\tIStream::CopyTo(0x%p, %Id, &%d, &%d)", pIStream, cb, cBytesRead, cBytesWritten);
	return hr;
}
예제 #16
0
HRESULT CStorageBuffer::UnlockRegion(  ULARGE_INTEGER libOffset,	//Specifies the byte offset for the beginning of the range
								ULARGE_INTEGER cb,			//Specifies the length of the range in bytes
								DWORD dwLockType)			//Specifies the access restriction previously placed on the range);
{
	//Locking is optional
	HRESULT hr = STG_E_INVALIDFUNCTION;
	TRACE_METHOD(hr, L"\tIStream::UnlockRegion()");
	return hr;
}
void PicturePileLayerContent::draw(SkCanvas* canvas)
{
    TRACE_METHOD();
    android::Mutex::Autolock lock(m_drawLock);
    m_picturePile.draw(canvas);

    if (CC_UNLIKELY(!m_hasContent))
        ALOGW("Warning: painting PicturePile without content!");
}
void PaintTileOperation::run(BaseRenderer* renderer)
{
    TRACE_METHOD();

    if (m_tile) {
        m_tile->paintBitmap(m_painter, renderer);
        m_tile->setRepaintPending(false);
        m_tile = 0;
    }
}
예제 #19
0
// Set the position on the control
HRESULT CControlSite::SetPosition(const RECT &rcPos)
{
    TRACE_METHOD(CControlSite::SetPosition);
    m_rcObjectPos = rcPos;
    if (m_spIOleInPlaceObject)
    {
        m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos);
    }
    return S_OK;
}
void PictureLayerContent::draw(SkCanvas* canvas)
{
    if (!m_picture)
        return;

    TRACE_METHOD();//4.2 Merge
    android::Mutex::Autolock lock(m_drawLock);
    SkRect r = SkRect::MakeWH(width(), height());
    canvas->clipRect(r);
    canvas->drawPicture(*m_picture);
}
예제 #21
0
// Execute the specified verb
HRESULT CControlSite::DoVerb(LONG nVerb, LPMSG lpMsg)
{
    TRACE_METHOD(CControlSite::DoVerb);

    if (m_spIOleObject == NULL)
    {
        return E_FAIL;
    }

    return m_spIOleObject->DoVerb(nVerb, lpMsg, this, 0, m_hWndParent, &m_rcObjectPos);
}
void SurfaceCollection::prepareGL(const SkRect& visibleContentRect, bool tryToFastBlit)
{
    TRACE_METHOD();
    updateLayerPositions(visibleContentRect);
    bool layerTilesDisabled = m_compositedRoot->state()->isSingleSurfaceRenderingMode();
    if (!layerTilesDisabled) {
        for (unsigned int i = 0; tryToFastBlit && i < m_surfaces.size(); i++)
            tryToFastBlit &= m_surfaces[i]->canUpdateWithBlit();
    }
    for (unsigned int i = 0; i < m_surfaces.size(); i++)
        m_surfaces[i]->prepareGL(layerTilesDisabled, tryToFastBlit);
}
예제 #23
0
v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
    /// M: add for systrace
    TRACE_METHOD()
    V8GCController::checkMemoryUsage();
    v8::Local<v8::Value> result;
    {
        if (m_recursion >= kMaxRecursionDepth) {
            v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')");
            if (code.IsEmpty())
                return result;
            v8::Local<v8::Script> script = v8::Script::Compile(code);
            if (script.IsEmpty())
                return result;
            script->Run();
            return result;
        }

        // Evaluating the JavaScript could cause the frame to be deallocated,
        // so we start the keep alive timer here.
        // Frame::keepAlive method adds the ref count of the frame and sets a
        // timer to decrease the ref count. It assumes that the current JavaScript
        // execution finishs before firing the timer.
        m_frame->keepAlive();

        InspectorInstrumentationCookie cookie;
        if (InspectorInstrumentation::hasFrontends()) {
            v8::ScriptOrigin origin = function->GetScriptOrigin();
            String resourceName("undefined");
            int lineNumber = 1;
            if (!origin.ResourceName().IsEmpty()) {
                resourceName = toWebCoreString(origin.ResourceName());
                lineNumber = function->GetScriptLineNumber() + 1;
            }
            cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
        }

        m_recursion++;
        result = function->Call(receiver, argc, args);
        m_recursion--;

        InspectorInstrumentation::didCallFunction(cookie);
    }

    // Release the storage mutex if applicable.
    didLeaveScriptContext();

    if (v8::V8::IsDead())
        handleFatalErrorInV8();

    return result;
}
예제 #24
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetDescription
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetDescription(BSTR* pbstrDescription)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorInfo)
	{
		//IErrorInfo::GetDescription
		XTEST(hr = m_pIErrorInfo->GetDescription(pbstrDescription));
		TRACE_METHOD(hr, L"IErrorInfo::GetDescription(&\"%s\")", pbstrDescription ? *pbstrDescription : NULL);
	}

	return hr;
}
예제 #25
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetHelpContext
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetHelpContext(DWORD* pdwHelpContext)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorInfo)
	{
		//IErrorInfo::GetHelpContext
		XTEST(hr = m_pIErrorInfo->GetHelpContext(pdwHelpContext));
		TRACE_METHOD(hr, L"IErrorInfo::GetHelpContext(&0x%08x)", pdwHelpContext ? *pdwHelpContext : NULL);
	}

	return hr;
}
예제 #26
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetHelpFile
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetHelpFile(BSTR* pbstrHelpFile)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorInfo)
	{
		//IErrorInfo::GetHelpFile
		XTEST(hr = m_pIErrorInfo->GetHelpFile(pbstrHelpFile));
		TRACE_METHOD(hr, L"IErrorInfo::GetHelpFile(&\"%s\")", pbstrHelpFile ? *pbstrHelpFile : NULL);
	}

	return hr;
}
예제 #27
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetRecordCount
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetRecordCount(ULONG* pulCount)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorRecords)
	{
		//IErrorRecords::GetRecordCount
		XTEST(hr = m_pIErrorRecords->GetRecordCount(pulCount));
		TRACE_METHOD(hr, L"IErrorRecords::GetRecordCount(&%d)", pulCount ? *pulCount : NULL);
	}

	return hr;
}
예제 #28
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetCustomErrorObject
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetCustomErrorObject(ULONG ulRecordNum,	REFIID riid, IUnknown** ppObject)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorRecords)
	{
		//IErrorRecords::GetCustomErrorObject
		XTEST(hr = m_pIErrorRecords->GetCustomErrorObject(ulRecordNum, riid, ppObject));
		TRACE_METHOD(hr, L"IErrorRecords::GetCustomErrorObject(%lu, %s, &%p)", ulRecordNum, GetInterfaceName(riid), ppObject ? *ppObject : NULL);
	}

	return hr;
}
예제 #29
0
/////////////////////////////////////////////////////////////////
// HRESULT CError::GetErrorInfo
//
/////////////////////////////////////////////////////////////////
HRESULT CError::GetErrorInfo(ULONG ulRecordNum,	LCID lcid, IErrorInfo** ppErrorInfo)
{
	HRESULT	hr = S_OK;

	if(m_pIErrorRecords)
	{
		//IErrorRecords::GetErrorInfo
		XTEST(hr = m_pIErrorRecords->GetErrorInfo(ulRecordNum, lcid, ppErrorInfo));
		TRACE_METHOD(hr, L"IErrorRecords::GetErrorInfo(%lu, %ld, &%p)", ulRecordNum, lcid, ppErrorInfo ? *ppErrorInfo : NULL);
	}

	return hr;
}
예제 #30
0
/////////////////////////////////////////////////////////////////
// HRESULT CCustomError::GetSQLInfo
//
/////////////////////////////////////////////////////////////////
HRESULT CCustomError::GetSQLInfo(BSTR* pbstrSQLState, LONG* plNativeError)
{
	HRESULT	hr = S_OK;

	if(m_pISQLErrorInfo)
	{
		//ISQLErrorInfo::GetSQLInfo
		XTEST(hr = m_pISQLErrorInfo->GetSQLInfo(pbstrSQLState, plNativeError));
		TRACE_METHOD(hr, L"ISQLErrorInfo::GetSQLInfo(&\"%s\", &%ld)", pbstrSQLState ? *pbstrSQLState : NULL, plNativeError ? *plNativeError : NULL);
	}

	return hr;
}