本文整理汇总了C++中nsAutoPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAutoPtr::get方法的具体用法?C++ nsAutoPtr::get怎么用?C++ nsAutoPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAutoPtr
的用法示例。
在下文中一共展示了nsAutoPtr::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
// static
PLDHashOperator
nsWindowBase::CancelTouchPoints(const unsigned int& aPointerId, nsAutoPtr<PointerInfo>& aInfo, void* aUserArg)
{
nsWindowBase* self = static_cast<nsWindowBase*>(aUserArg);
self->InjectTouchPoint(aInfo.get()->mPointerId, aInfo.get()->mPosition, POINTER_FLAG_CANCELED);
return (PLDHashOperator)(PL_DHASH_NEXT|PL_DHASH_REMOVE);
}
示例2: Document
bool
RestyleTracker::GetRestyleData(Element* aElement, nsAutoPtr<RestyleData>& aData)
{
NS_PRECONDITION(aElement->GetCrossShadowCurrentDoc() == Document(),
"Unexpected document; this will lead to incorrect behavior!");
if (!aElement->HasFlag(RestyleBit())) {
NS_ASSERTION(!aElement->HasFlag(RootBit()), "Bogus root bit?");
return false;
}
mPendingRestyles.RemoveAndForget(aElement, aData);
NS_ASSERTION(aData.get(), "Must have data if restyle bit is set");
if (aData->mRestyleHint & eRestyle_LaterSiblings) {
// Someone readded the eRestyle_LaterSiblings hint for this
// element. Leave it around for now, but remove the other restyle
// hints and the change hint for it. Also unset its root bit,
// since it's no longer a root with the new restyle data.
NS_ASSERTION(aData->mDescendants.IsEmpty(),
"expected descendants to be handled by now");
RestyleData* newData = new RestyleData;
newData->mChangeHint = nsChangeHint(0);
newData->mRestyleHint = eRestyle_LaterSiblings;
mPendingRestyles.Put(aElement, newData);
aElement->UnsetFlags(RootBit());
aData->mRestyleHint =
nsRestyleHint(aData->mRestyleHint & ~eRestyle_LaterSiblings);
} else {
aElement->UnsetFlags(mRestyleBits);
}
return true;
}
示例3:
PLDHashOperator
SpdyStream::hdrHashEnumerate(const nsACString &key,
nsAutoPtr<nsCString> &value,
void *closure)
{
SpdyStream *self = static_cast<SpdyStream *>(closure);
self->CompressToFrame(key);
self->CompressToFrame(value.get());
return PL_DHASH_NEXT;
}
示例4: UnixSocketRawData
nsresult
RilSocketIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer)
{
MOZ_ASSERT(aBuffer);
if (!mBuffer) {
mBuffer = new UnixSocketRawData(MAX_READ_SIZE);
}
*aBuffer = mBuffer.get();
return NS_OK;
}
示例5: DaemonSocketPDU
nsresult
DaemonSocketIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer)
{
MOZ_ASSERT(aBuffer);
if (!mPDU) {
/* There's only one PDU for receiving. We reuse it every time. */
mPDU = new DaemonSocketPDU(DaemonSocketPDU::MAX_PAYLOAD_LENGTH);
}
*aBuffer = mPDU.get();
return NS_OK;
}
示例6: Document
bool
RestyleTracker::GetRestyleData(Element* aElement, nsAutoPtr<RestyleData>& aData)
{
NS_PRECONDITION(aElement->GetComposedDoc() == Document(),
"Unexpected document; this will lead to incorrect behavior!");
if (!aElement->HasFlag(RestyleBit())) {
NS_ASSERTION(!aElement->HasFlag(RootBit()), "Bogus root bit?");
return false;
}
mPendingRestyles.RemoveAndForget(aElement, aData);
NS_ASSERTION(aData.get(), "Must have data if restyle bit is set");
if (aData->mRestyleHint & eRestyle_LaterSiblings) {
// Someone readded the eRestyle_LaterSiblings hint for this
// element. Leave it around for now, but remove the other restyle
// hints and the change hint for it. Also unset its root bit,
// since it's no longer a root with the new restyle data.
// During a normal restyle, we should have already processed the
// mDescendants array the last time we processed the restyle
// for this element. But in RebuildAllStyleData, we don't initially
// expand out eRestyle_LaterSiblings, so we can get in here the
// first time we need to process a restyle for this element. In that
// case, it's fine for us to have a non-empty mDescendants, since
// we know that RebuildAllStyleData adds eRestyle_ForceDescendants
// and we're guaranteed we'll restyle the entire tree.
NS_ASSERTION(mRestyleManager->InRebuildAllStyleData() ||
aData->mDescendants.IsEmpty(),
"expected descendants to be handled by now");
RestyleData* newData = new RestyleData;
newData->mChangeHint = nsChangeHint(0);
newData->mRestyleHint = eRestyle_LaterSiblings;
mPendingRestyles.Put(aElement, newData);
aElement->UnsetFlags(RootBit());
aData->mRestyleHint =
nsRestyleHint(aData->mRestyleHint & ~eRestyle_LaterSiblings);
} else {
aElement->UnsetFlags(mRestyleBits);
}
return true;
}
示例7: GetStatsForLongTermStorage_s
static void GetStatsForLongTermStorage_s(
nsAutoPtr<RTCStatsQuery> query) {
MOZ_ASSERT(query);
nsresult rv = PeerConnectionImpl::ExecuteStatsQuery_s(query.get());
// Check whether packets were dropped due to rate limiting during
// this call. (These calls must be made on STS)
unsigned char rate_limit_bit_pattern = 0;
if (!mozilla::nr_socket_short_term_violation_time().IsNull() &&
mozilla::nr_socket_short_term_violation_time() >= query->iceStartTime) {
rate_limit_bit_pattern |= 1;
}
if (!mozilla::nr_socket_long_term_violation_time().IsNull() &&
mozilla::nr_socket_long_term_violation_time() >= query->iceStartTime) {
rate_limit_bit_pattern |= 2;
}
if (query->failed) {
Telemetry::Accumulate(
Telemetry::WEBRTC_STUN_RATE_LIMIT_EXCEEDED_BY_TYPE_GIVEN_FAILURE,
rate_limit_bit_pattern);
} else {
Telemetry::Accumulate(
Telemetry::WEBRTC_STUN_RATE_LIMIT_EXCEEDED_BY_TYPE_GIVEN_SUCCESS,
rate_limit_bit_pattern);
}
// Even if Telemetry::Accumulate is threadsafe, we still need to send the
// query back to main, since that is where it must be destroyed.
NS_DispatchToMainThread(
WrapRunnableNM(
&StoreLongTermICEStatisticsImpl_m,
rv,
query),
NS_DISPATCH_NORMAL);
}
示例8: OnPaint
bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
{
// We never have reentrant paint events, except when we're running our RPC
// windows event spin loop. If we don't trap for this, we'll try to paint,
// but view manager will refuse to paint the surface, resulting is black
// flashes on the plugin rendering surface.
if (mozilla::ipc::RPCChannel::IsSpinLoopActive() && mPainting)
return false;
if (mWindowType == eWindowType_plugin) {
/**
* After we CallUpdateWindow to the child, occasionally a WM_PAINT message
* is posted to the parent event loop with an empty update rect. Do a
* dummy paint so that Windows stops dispatching WM_PAINT in an inifinite
* loop. See bug 543788.
*/
RECT updateRect;
if (!GetUpdateRect(mWnd, &updateRect, FALSE) ||
(updateRect.left == updateRect.right &&
updateRect.top == updateRect.bottom)) {
PAINTSTRUCT ps;
BeginPaint(mWnd, &ps);
EndPaint(mWnd, &ps);
return true;
}
PluginInstanceParent* instance = reinterpret_cast<PluginInstanceParent*>(
::GetPropW(mWnd, L"PluginInstanceParentProperty"));
if (instance) {
unused << instance->CallUpdateWindow();
} else {
// We should never get here since in-process plugins should have
// subclassed our HWND and handled WM_PAINT, but in some cases that
// could fail. Return without asserting since it's not our fault.
NS_WARNING("Plugin failed to subclass our window");
}
ValidateRect(mWnd, NULL);
return true;
}
// Do an early async composite so that we at least have something on screen
// in the right place, even if the content is out of date.
if (GetLayerManager()->GetBackendType() == LAYERS_CLIENT &&
mCompositorParent) {
mCompositorParent->ScheduleRenderOnCompositorThread();
}
nsIWidgetListener* listener = GetPaintListener();
if (listener) {
listener->WillPaintWindow(this);
}
// Re-get the listener since the will paint notification may have killed it.
listener = GetPaintListener();
if (!listener)
return false;
bool result = true;
PAINTSTRUCT ps;
#ifdef MOZ_XUL
if (!aDC && (eTransparencyTransparent == mTransparencyMode))
{
// For layered translucent windows all drawing should go to memory DC and no
// WM_PAINT messages are normally generated. To support asynchronous painting
// we force generation of WM_PAINT messages by invalidating window areas with
// RedrawWindow, InvalidateRect or InvalidateRgn function calls.
// BeginPaint/EndPaint must be called to make Windows think that invalid area
// is painted. Otherwise it will continue sending the same message endlessly.
::BeginPaint(mWnd, &ps);
::EndPaint(mWnd, &ps);
aDC = mMemoryDC;
}
#endif
mPainting = true;
#ifdef WIDGET_DEBUG_OUTPUT
HRGN debugPaintFlashRegion = NULL;
HDC debugPaintFlashDC = NULL;
if (debug_WantPaintFlashing())
{
debugPaintFlashRegion = ::CreateRectRgn(0, 0, 0, 0);
::GetUpdateRgn(mWnd, debugPaintFlashRegion, TRUE);
debugPaintFlashDC = ::GetDC(mWnd);
}
#endif // WIDGET_DEBUG_OUTPUT
HDC hDC = aDC ? aDC : (::BeginPaint(mWnd, &ps));
if (!IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D)) {
mPaintDC = hDC;
}
#ifdef MOZ_XUL
bool forceRepaint = aDC || (eTransparencyTransparent == mTransparencyMode);
#else
bool forceRepaint = NULL != aDC;
//.........这里部分代码省略.........
示例9:
/* [noscript] attribute SpdyPushCachePtr spdyPushCache; */
NS_IMETHODIMP
nsLoadGroupConnectionInfo::GetSpdyPushCache(mozilla::net::SpdyPushCache **aSpdyPushCache)
{
*aSpdyPushCache = mSpdyCache.get();
return NS_OK;
}
示例10: OnPaint
//.........这里部分代码省略.........
mPaintDC = hDC;
}
#ifdef MOZ_XUL
PRBool forceRepaint = aDC || (eTransparencyTransparent == mTransparencyMode);
#else
PRBool forceRepaint = NULL != aDC;
#endif
nsCOMPtr<nsIRegion> paintRgnWin = GetRegionToPaint(forceRepaint, ps, hDC);
if (paintRgnWin &&
!paintRgnWin->IsEmpty() &&
mEventCallback)
{
// generate the event and call the event callback
nsPaintEvent event(PR_TRUE, NS_PAINT, this);
InitEvent(event);
event.region = paintRgnWin;
event.rect = nsnull;
// Should probably pass in a real region here, using GetRandomRgn
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/clipping_4q0e.asp
#ifdef WIDGET_DEBUG_OUTPUT
debug_DumpPaintEvent(stdout,
this,
&event,
nsCAutoString("noname"),
(PRInt32) mWnd);
#endif // WIDGET_DEBUG_OUTPUT
nsRefPtr<gfxASurface> targetSurface;
#if defined(MOZ_XUL)
// don't support transparency for non-GDI rendering, for now
if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI) && eTransparencyTransparent == mTransparencyMode) {
if (mTransparentSurface == nsnull)
SetupTranslucentWindowMemoryBitmap(mTransparencyMode);
targetSurface = mTransparentSurface;
}
#endif
nsRefPtr<gfxWindowsSurface> targetSurfaceWin;
if (!targetSurface &&
IsRenderMode(gfxWindowsPlatform::RENDER_GDI))
{
targetSurfaceWin = new gfxWindowsSurface(hDC);
targetSurface = targetSurfaceWin;
}
#ifdef CAIRO_HAS_D2D_SURFACE
if (!targetSurface &&
IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D))
{
if (!mD2DWindowSurface) {
mD2DWindowSurface = new gfxD2DSurface(mWnd);
}
targetSurface = mD2DWindowSurface;
}
#endif
#ifdef CAIRO_HAS_DDRAW_SURFACE
nsRefPtr<gfxDDrawSurface> targetSurfaceDDraw;
if (!targetSurface &&
(IsRenderMode(gfxWindowsPlatform::RENDER_DDRAW) ||
IsRenderMode(gfxWindowsPlatform::RENDER_DDRAW_GL)))