mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
Bug 1735152 - Avoid using NS_ADDREF in nsSocketTransport. r=dragana, a=RyanVM
This commit is contained in:
parent
6bc10cbc95
commit
1920aae3dc
1 changed files with 14 additions and 10 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
/* vim:set ts=4 sw=4 et cindent: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -2115,7 +2114,7 @@ NS_IMETHODIMP
|
||||||
nsSocketTransport::OpenInputStream(uint32_t flags,
|
nsSocketTransport::OpenInputStream(uint32_t flags,
|
||||||
uint32_t segsize,
|
uint32_t segsize,
|
||||||
uint32_t segcount,
|
uint32_t segcount,
|
||||||
nsIInputStream **result)
|
nsIInputStream **aResult)
|
||||||
{
|
{
|
||||||
SOCKET_LOG(("nsSocketTransport::OpenInputStream [this=%p flags=%x]\n",
|
SOCKET_LOG(("nsSocketTransport::OpenInputStream [this=%p flags=%x]\n",
|
||||||
this, flags));
|
this, flags));
|
||||||
|
|
@ -2124,6 +2123,7 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIAsyncInputStream> pipeIn;
|
nsCOMPtr<nsIAsyncInputStream> pipeIn;
|
||||||
|
nsCOMPtr<nsIInputStream> result;
|
||||||
|
|
||||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||||
|
|
@ -2143,18 +2143,20 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
|
||||||
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
|
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
*result = pipeIn;
|
result = pipeIn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*result = &mInput;
|
result = &mInput;
|
||||||
|
|
||||||
// flag input stream as open
|
// flag input stream as open
|
||||||
mInputClosed = false;
|
mInputClosed = false;
|
||||||
|
|
||||||
rv = PostEvent(MSG_ENSURE_CONNECT);
|
rv = PostEvent(MSG_ENSURE_CONNECT);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
NS_ADDREF(*result);
|
result.forget(aResult);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2162,7 +2164,7 @@ NS_IMETHODIMP
|
||||||
nsSocketTransport::OpenOutputStream(uint32_t flags,
|
nsSocketTransport::OpenOutputStream(uint32_t flags,
|
||||||
uint32_t segsize,
|
uint32_t segsize,
|
||||||
uint32_t segcount,
|
uint32_t segcount,
|
||||||
nsIOutputStream **result)
|
nsIOutputStream **aResult)
|
||||||
{
|
{
|
||||||
SOCKET_LOG(("nsSocketTransport::OpenOutputStream [this=%p flags=%x]\n",
|
SOCKET_LOG(("nsSocketTransport::OpenOutputStream [this=%p flags=%x]\n",
|
||||||
this, flags));
|
this, flags));
|
||||||
|
|
@ -2171,6 +2173,8 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
|
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
|
||||||
|
nsCOMPtr<nsIOutputStream> result;
|
||||||
|
|
||||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||||
//bool openBuffered = !(flags & OPEN_UNBUFFERED);
|
//bool openBuffered = !(flags & OPEN_UNBUFFERED);
|
||||||
|
|
@ -2189,10 +2193,10 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
||||||
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
|
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
*result = pipeOut;
|
result = pipeOut;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*result = &mOutput;
|
result = &mOutput;
|
||||||
|
|
||||||
// flag output stream as open
|
// flag output stream as open
|
||||||
mOutputClosed = false;
|
mOutputClosed = false;
|
||||||
|
|
@ -2200,7 +2204,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
||||||
rv = PostEvent(MSG_ENSURE_CONNECT);
|
rv = PostEvent(MSG_ENSURE_CONNECT);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
NS_ADDREF(*result);
|
result.forget(aResult);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue