本文整理汇总了C++中nsCOMPtr::Cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::Cancel方法的具体用法?C++ nsCOMPtr::Cancel怎么用?C++ nsCOMPtr::Cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::Cancel方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartTimer
NS_IMETHODIMP
nsIncrementalDownload::Cancel(nsresult status)
{
NS_ENSURE_ARG(NS_FAILED(status));
// Ignore this cancelation if we're already canceled.
if (NS_FAILED(mStatus))
return NS_OK;
mStatus = status;
// Nothing more to do if callbacks aren't pending.
if (!mIsPending)
return NS_OK;
if (mChannel) {
mChannel->Cancel(mStatus);
NS_ASSERTION(!mTimer, "what is this timer object doing here?");
}
else {
// dispatch a timer callback event to drive invoking our listener's
// OnStopRequest.
if (mTimer)
mTimer->Cancel();
StartTimer(0);
}
return NS_OK;
}
示例2: LOG
NS_IMETHODIMP
PendingLookup::Notify(nsITimer* aTimer)
{
LOG(("Remote lookup timed out [this = %p]", this));
MOZ_ASSERT(aTimer == mTimeoutTimer);
mChannel->Cancel(NS_ERROR_NET_TIMEOUT);
mTimeoutTimer->Cancel();
return NS_OK;
}
示例3: LOG
NS_IMETHODIMP
PendingLookup::Notify(nsITimer* aTimer)
{
LOG(("Remote lookup timed out [this = %p]", this));
MOZ_ASSERT(aTimer == mTimeoutTimer);
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT,
true);
mChannel->Cancel(NS_ERROR_NET_TIMEOUT);
mTimeoutTimer->Cancel();
return NS_OK;
}
示例4:
///////////////////////////////////////////////////////////////////////////////
// nsIObserver implementation
NS_IMETHODIMP
PendingLookup::Observe(nsISupports *aSubject, const char *aTopic,
const char16_t *aData)
{
if (!strcmp(aTopic, "quit-application")) {
if (mTimeoutTimer) {
mTimeoutTimer->Cancel();
mTimeoutTimer = nullptr;
}
if (mChannel) {
mChannel->Cancel(NS_ERROR_ABORT);
}
}
return NS_OK;
}
示例5: sUnregisterPowerSettingNotification
void
DisableBatteryNotifications()
{
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (IsVistaOrLater()) {
if (sPowerHandle) {
sUnregisterPowerSettingNotification(sPowerHandle);
sPowerHandle = nsnull;
}
if (sCapacityHandle) {
sUnregisterPowerSettingNotification(sCapacityHandle);
sCapacityHandle = nsnull;
}
if (sHWnd) {
DestroyWindow(sHWnd);
sHWnd = nsnull;
}
} else
#endif
{
if (sUpdateTimer) {
sUpdateTimer->Cancel();
sUpdateTimer = nsnull;
}
}
}
示例6: sUnregisterPowerSettingNotification
void
DisableBatteryNotifications()
{
if (IsVistaOrLater()) {
if (sPowerHandle) {
sUnregisterPowerSettingNotification(sPowerHandle);
sPowerHandle = nullptr;
}
if (sCapacityHandle) {
sUnregisterPowerSettingNotification(sCapacityHandle);
sCapacityHandle = nullptr;
}
if (sHWnd) {
DestroyWindow(sHWnd);
sHWnd = nullptr;
}
} else
{
if (sUpdateTimer) {
sUpdateTimer->Cancel();
sUpdateTimer = nullptr;
}
}
}
示例7: ScanForRawInputDevices
void
WindowsGamepadService::ScanForDevices()
{
for (int i = mGamepads.Length() - 1; i >= 0; i--) {
mGamepads[i].present = false;
}
if (mHID) {
ScanForRawInputDevices();
}
if (mXInput) {
mXInputPollTimer->Cancel();
if (ScanForXInputDevices()) {
mXInputPollTimer->InitWithFuncCallback(XInputPollTimerCallback,
this,
kXInputPollInterval,
nsITimer::TYPE_REPEATING_SLACK);
}
}
// Look for devices that are no longer present and remove them.
for (int i = mGamepads.Length() - 1; i >= 0; i--) {
if (!mGamepads[i].present) {
RemoveGamepad(mGamepads[i].id);
mGamepads.RemoveElementAt(i);
}
}
}
示例8:
void
nsListScrollSmoother::Stop()
{
if ( mRepeatTimer ) {
mRepeatTimer->Cancel();
mRepeatTimer = nullptr;
}
}
示例9:
void
WindowsGamepadService::Cleanup()
{
if (mXInputPollTimer) {
mXInputPollTimer->Cancel();
}
mGamepads.Clear();
}
示例10:
// This may be called before or after OnLookupComplete
void
PendingPACQuery::Complete(nsresult status, const nsCString &pacString)
{
if (!mCallback)
return;
mCallback->OnQueryComplete(status, pacString);
mCallback = nsnull;
if (mDNSRequest) {
mDNSRequest->Cancel(NS_ERROR_ABORT);
mDNSRequest = nsnull;
}
}
示例11: Accumulate
nsresult
PendingLookup::OnComplete(bool shouldBlock, nsresult rv)
{
if (mTimeoutTimer) {
mTimeoutTimer->Cancel();
mTimeoutTimer = nullptr;
}
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
shouldBlock);
double t = (TimeStamp::Now() - mStartTime).ToMilliseconds();
if (shouldBlock) {
LOG(("Application Reputation check failed, blocking bad binary in %f ms "
"[this = %p]", t, this));
} else {
LOG(("Application Reputation check passed in %f ms [this = %p]", t, this));
}
nsresult res = mCallback->OnComplete(shouldBlock, rv);
return res;
}
示例12:
// There needs to be a means of distinguishing between connection errors
// that the SOCKS server reports when it rejects a connection request, and
// connection errors that happen while attempting to connect to the SOCKS
// server. Otherwise, Firefox will report incorrectly that the proxy server
// is refusing connections when a SOCKS request is rejected by the proxy.
// When a SOCKS handshake failure occurs, the PR error is set to
// PR_UNKNOWN_ERROR, and the real error code is returned via the OS error.
void
nsSOCKSSocketInfo::HandshakeFinished(PRErrorCode err)
{
if (err == 0) {
mState = SOCKS_CONNECTED;
} else {
mState = SOCKS_FAILED;
PR_SetError(PR_UNKNOWN_ERROR, err);
}
// We don't need the buffer any longer, so free it.
delete [] mData;
mData = nullptr;
mDataIoPtr = nullptr;
mDataLength = 0;
mReadOffset = 0;
mAmountToRead = 0;
if (mLookup) {
mLookup->Cancel(NS_ERROR_FAILURE);
mLookup = nullptr;
}
}
示例13: nsevent
NS_IMETHODIMP
nsSoftKeyBoard::HandleEvent(nsIDOMEvent* aEvent)
{
if (!aEvent)
return NS_OK;
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
nsCOMPtr<nsIDOMEventTarget> target;
nsevent->GetOriginalTarget(getter_AddRefs(target));
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);
if (!targetContent || !targetContent->IsNodeOfType(nsINode::eHTML_FORM_CONTROL))
return NS_OK;
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(targetContent));
if (!formControl)
return NS_OK;
PRInt32 controlType = formControl->GetType();
if (controlType != NS_FORM_TEXTAREA && controlType != NS_FORM_INPUT_TEXT &&
controlType != NS_FORM_INPUT_PASSWORD && controlType != NS_FORM_INPUT_FILE)
{
return NS_OK;
}
nsAutoString eventType;
aEvent->GetType(eventType);
if (eventType.EqualsLiteral("keypress"))
{
PRUint32 keyCode;
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
if (!keyEvent)
return NS_OK;
if (NS_FAILED(keyEvent->GetKeyCode(&keyCode)))
return NS_OK;
if (keyCode == nsIDOMKeyEvent::DOM_VK_RETURN && controlType != NS_FORM_TEXTAREA)
{
nsSoftKeyBoardService::CloseSIP();
}
#ifdef WINCE
if (IsSmartphone())
{
PRUint32 charCode;
keyEvent->GetCharCode(&charCode);
#if 0
char buffer[2];
sprintf(buffer, "%d = %d", keyCode, charCode);
MessageBox(0, buffer, buffer, 0);
#endif
/* value determined by inspection */
if (keyCode == 120)
{
// We're using this key, no one else should
aEvent->StopPropagation();
aEvent->PreventDefault();
if (mTimer)
mTimer->Cancel();
keybd_event(VK_SPACE, 0, 0, 0);
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
return NS_OK;
}
/* value determined by inspection */
if (keyCode == 119)
{
// We're using this key, no one else should
aEvent->StopPropagation();
aEvent->PreventDefault();
if (mTimer)
mTimer->Cancel();
mUsage++;
if (mUsage>eUpperCase)
mUsage=eNumbers;
return NS_OK;
}
if (mUsage == eNumbers)
return NS_OK;
if ( charCode > nsIDOMKeyEvent::DOM_VK_0 && charCode <= nsIDOMKeyEvent::DOM_VK_9) // [0-9)
{
//.........这里部分代码省略.........