本文整理汇总了C++中nsCOMPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::Close方法的具体用法?C++ nsCOMPtr::Close怎么用?C++ nsCOMPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::Close方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Disconnect
// when this is called the browser side wants no more part of it
nsresult
nsWebSocketEstablishedConnection::Close()
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
if (!mOwner)
return NS_OK;
// Disconnect() can release this object, so we keep a
// reference until the end of the method
nsRefPtr<nsWebSocketEstablishedConnection> kungfuDeathGrip = this;
if (mOwner->mReadyState == nsIMozWebSocket::CONNECTING) {
mOwner->SetReadyState(nsIMozWebSocket::CLOSED);
mWebSocketChannel->Close(mOwner->mClientReasonCode,
mOwner->mClientReason);
Disconnect();
return NS_OK;
}
mOwner->SetReadyState(nsIMozWebSocket::CLOSING);
if (mStatus == CONN_CLOSED) {
mOwner->SetReadyState(nsIMozWebSocket::CLOSED);
Disconnect();
return NS_OK;
}
return mWebSocketChannel->Close(mOwner->mClientReasonCode,
mOwner->mClientReason);
}
示例2: ShutdownThreadEvent
void
ServeResourceEvent::Shutdown()
{
// Cleanup resources and exit.
mInput->Close();
mOutput->Close();
// To shutdown the current thread we need to first exit this event.
// The Shutdown event below is posted to the main thread to do this.
nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(NS_GetCurrentThread());
NS_DispatchToMainThread(event);
}
示例3:
NS_IMETHODIMP
nsJARInputThunk::Close()
{
nsresult rv = NS_OK;
if (mJarStream)
rv = mJarStream->Close();
if (!mUsingJarCache && mJarReader)
mJarReader->Close();
mJarReader = nullptr;
return rv;
}
示例4:
NS_IMETHODIMP
nsJARInputThunk::Close()
{
if (mJarStream)
return mJarStream->Close();
return NS_OK;
}
示例5:
NS_IMETHODIMP
nsMsgSaveAsListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus)
{
if (m_outputStream)
{
m_outputStream->Flush();
m_outputStream->Close();
}
return NS_OK;
}
示例6:
NS_IMETHODIMP
nsOutputStreamTransport::Close()
{
if (mCloseWhenDone)
mSink->Close();
// make additional writes return early...
mOffset = mLimit = 0;
return NS_OK;
}
示例7: while
void
nsFileCopyEvent::DoCopy()
{
// We'll copy in chunks this large by default. This size affects how
// frequently we'll check for interrupts.
const int32_t chunk = nsIOService::gDefaultSegmentSize * nsIOService::gDefaultSegmentCount;
nsresult rv = NS_OK;
int64_t len = mLen, progress = 0;
while (len) {
// If we've been interrupted, then stop copying.
rv = mInterruptStatus;
if (NS_FAILED(rv))
break;
int32_t num = std::min((int32_t) len, chunk);
uint32_t result;
rv = mSource->ReadSegments(NS_CopySegmentToStream, mDest, num, &result);
if (NS_FAILED(rv))
break;
if (result != (uint32_t) num) {
rv = NS_ERROR_FILE_DISK_FULL; // stopped prematurely (out of disk space)
break;
}
// Dispatch progress notification
if (mSink) {
progress += num;
mSink->OnTransportStatus(nullptr, NS_NET_STATUS_WRITING, progress,
mLen);
}
len -= num;
}
if (NS_FAILED(rv))
mStatus = rv;
// Close the output stream before notifying our callback so that others may
// freely "play" with the file.
mDest->Close();
// Notify completion
if (mCallback) {
mCallbackTarget->Dispatch(mCallback, NS_DISPATCH_NORMAL);
// Release the callback on the target thread to avoid destroying stuff on
// the wrong thread.
nsIRunnable *doomed = nullptr;
mCallback.swap(doomed);
NS_ProxyRelease(mCallbackTarget, doomed);
}
}
示例8:
NS_IMETHODIMP
nsInputStreamTee::Close()
{
if (NS_WARN_IF(!mSource)) {
return NS_ERROR_NOT_INITIALIZED;
}
nsresult rv = mSource->Close();
mSource = 0;
mSink = 0;
return rv;
}
示例9: CloseWithStatus
NS_IMETHODIMP
nsGopherContentStream::CloseWithStatus(nsresult status)
{
if (mSocket) {
mSocket->Close(status);
mSocket = nsnull;
mSocketInput = nsnull;
mSocketOutput = nsnull;
}
return nsBaseContentStream::CloseWithStatus(status);
}
示例10: AssertRunningOnLoggerThread
void
Logger::CloseFile()
{
AssertRunningOnLoggerThread();
MOZ_ASSERT(mLogFile);
if (!mLogFile) {
return;
}
Flush();
mLogFile->Close();
mLogFile = nullptr;
}
示例11: Observe
NS_IMETHOD
Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) override
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(strcmp(aTopic, DOM_WINDOW_DESTROYED_TOPIC) == 0);
if (!mStream) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mGlobal);
if (!SameCOMIdentity(aSubject, window)) {
return NS_OK;
}
// mStream->Close() will call JSStreamConsumer::OnInputStreamReady which may
// then destory itself, dropping the last reference to 'this'.
RefPtr<WindowStreamOwner> keepAlive(this);
mStream->Close();
mStream = nullptr;
mGlobal = nullptr;
return NS_OK;
}
示例12: Close
// nsIInputStream
NS_IMETHODIMP nsMIMEInputStream::Close(void) { INITSTREAMS; return mStream->Close(); }
示例13: Close
NS_IMETHOD
Close() override
{
return mStream->Close();
}