зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1735152 - Avoid using NS_ADDREF in nsSocketTransport r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D128088
This commit is contained in:
Родитель
f3ed253216
Коммит
34f1a3d7a0
|
@ -2263,7 +2263,8 @@ NS_IMPL_CI_INTERFACE_GETTER(nsSocketTransport, nsISocketTransport, nsITransport,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::OpenInputStream(uint32_t flags, uint32_t segsize,
|
||||
uint32_t segcount, nsIInputStream** result) {
|
||||
uint32_t segcount,
|
||||
nsIInputStream** aResult) {
|
||||
SOCKET_LOG(
|
||||
("nsSocketTransport::OpenInputStream [this=%p flags=%x]\n", this, flags));
|
||||
|
||||
|
@ -2271,6 +2272,7 @@ nsSocketTransport::OpenInputStream(uint32_t flags, uint32_t segsize,
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncInputStream> pipeIn;
|
||||
nsCOMPtr<nsIInputStream> result;
|
||||
|
||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||
|
@ -2290,25 +2292,27 @@ nsSocketTransport::OpenInputStream(uint32_t flags, uint32_t segsize,
|
|||
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = pipeIn;
|
||||
result = pipeIn;
|
||||
} else {
|
||||
*result = &mInput;
|
||||
result = &mInput;
|
||||
}
|
||||
|
||||
// flag input stream as open
|
||||
mInputClosed = false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::OpenOutputStream(uint32_t flags, uint32_t segsize,
|
||||
uint32_t segcount,
|
||||
nsIOutputStream** result) {
|
||||
nsIOutputStream** aResult) {
|
||||
SOCKET_LOG(("nsSocketTransport::OpenOutputStream [this=%p flags=%x]\n", this,
|
||||
flags));
|
||||
|
||||
|
@ -2316,6 +2320,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags, uint32_t segsize,
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
|
||||
nsCOMPtr<nsIOutputStream> result;
|
||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||
// bool openBuffered = !(flags & OPEN_UNBUFFERED);
|
||||
|
@ -2334,9 +2339,9 @@ nsSocketTransport::OpenOutputStream(uint32_t flags, uint32_t segsize,
|
|||
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = pipeOut;
|
||||
result = pipeOut;
|
||||
} else {
|
||||
*result = &mOutput;
|
||||
result = &mOutput;
|
||||
}
|
||||
|
||||
// flag output stream as open
|
||||
|
@ -2345,7 +2350,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags, uint32_t segsize,
|
|||
rv = PostEvent(MSG_ENSURE_CONNECT);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ADDREF(*result);
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче