Files
palemoon27/toolkit/devtools/server/FileDescriptorOutputStream.cpp
roytam1 5a6524c1db import changes from `dev' branch of rmottola/Arctic-Fox:
- partly import Bug 1201597 - Part 0: Make saveHeapSnapshot return the file path rather than take it as a parameter; r=bholley (85652707)
- partly import Bug 1201597 - Part 2: Add an IPDL subprotocol for opening core dump files to (f9c9b2b7)
- Bug 1184426 - Unprefix RTCIceCandidatePairStats.priority (formerly mozPriority). r=bwc, r=smaug (3381192783)
- Bug 1211793 - Remove unnecessary creation of "MediaDecoder" log module. r=gerald. (ed090bfe9c)
- Bug 1215532. Make sure the exposure set of the generated iterator interface matches that of the iterable it's created for, and that IterableIterator is exposed everywhere. r=qdot (d580e5a3dc)
- Bug 1215755. Change the Web IDL parser to just put a next() method initerator interfaces instead of using an additional IterableIterator interface. Fix up the other test failures in test_interface_maplikesetlikeiterable.py while I'm here. r=qdot (568f46851e)
- Bug 961329 - Implement JS::ubi::DominatorTree; r=sfink (b0cee6e886)
- Bug 1194991 - Part a: rewrite test_const.py to simplify adding new tests; r=khuey (510c69e81e)
- Bug 1194991 - Part b: coerce WebIDL constants to the correct type; r=khuey (8076a19ff9)
- Bug 1186142 - Make selector arg optional on PeerConnection.getStats(). r=bz (58041a2533)
- Bug 1215519 - Switch to DOMTimeStamp for RTCCertificate. r=bz (0bfba3a6ac)
- Bug 1152538 - RTCIdentityAssertion is a dictionary, r=smaug (b0c525ab44)
- Bug 1214867 - Add HeapSnapshot.prototype.creationTime; r=bholley (d533dfb5be)
- Bug 1225588 - Expose DominatorTree to JavaScript; r=sfink,bz (bed975d820)
- Bug 1223512 - Validate that every edge referent is in the heap snapshot; r=shu (170fdfac5e)
- Bug 1218597 - Limit the number of stack frames serialized in core dumps; r=froydnj (3d69d6515f)
- Bug 1153294 - Exposing Document.documentLoadGroup to Chrome JS, r=sicking (4b1f6fcfc3)
- Bug 1221292 - move nondeterministicGetWeakMapKeys to ThreadSafeChromeUtils; r=bz (7c528633b5)
- Bug 1223954 - don't use implicitJSContext for readHeapSnapshot and saveHeapSnapshot; r=bz (22f6ebf124)
- Bug 1204155 - Account for OOM in CryptoKey::SetSymKey() r=mt (d8e5713ad1)
- Bug 1204155 - Check if we're OOM when calling SECKEY_CopyPrivateKey() and SECKEY_CopyPublicKey() r=mt (8f1a9143ce)
- Bug 1001691 - Make GenerateAsymmetricKeyTask::mKeyPair a UniquePtr so that we can explicitly release it on the main thread r=mt (40fa47ffae)
- Bug 1213937 - Make WebRTC certificates SHA-256 only, r=drno (c1e3d2fd23)
- Bug 1158886 - Correct public key argument names for CryptoKey::PublicKeyToSpki() and ::PublicKeyToJwk() r=rbarnes (f70b95a51d)
- Bug 901698 - Implement OCSP-must-staple; r=keeler (4abe7c7616)
- Bug 1213203 - AsymmetricSignVerifyTask::DoCrypto() creates unused SGN Context r=mt (afef1029de)
- Bug 1188750 - CryptoKey::ReadStructuredClone() needs to ensure NSS is initialized before trying to deserialize a key r=keeler (12c4d54ece)
- Bug 1001691 - Implement WebCrypto thread pool r=bz (60cfa74a56)
- Bug 1001691 - Use thread pool for WebCrypto operations r=bz (dd61402a0c)
- Bug 1207090 - Expose TCPSocket to chrome contexts. r=bz (e17fd13133)
- Bug 1210330 - TCPSocket data event should be an ArrayBuffer in non-e10s case too. r=jdm (6bf1210377)
- Bug 1219476 (part 1) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (da793ddf99)
- Bug 1219476 (part 2) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (d87f0ea067)
- Bug 1219476 (part 3) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (5715cffabf)
- Bug 1219476 (part 4) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (7f203f36de)
- Bug 1219476 (part 5) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (65d1438d2e)
- Bug 1211360 - Don't snap for non-translation 3D transform. r=roc (e11c2b9104)
- Bug 1198996 - Ensure layer local opacity is clamped to 0..1 range. r=Bas (9b90e4348a)
- Bug 1222661 - Replace ToUnknown(obj) and FromUnknown(obj) with obj.ToUnknown*() and FromUnknown*(obj). r=nical (6da1eeedab)
2023-01-12 11:55:54 +08:00

86 lines
2.1 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/* 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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/devtools/FileDescriptorOutputStream.h"
#include "private/pprio.h"
namespace mozilla {
namespace devtools {
/* static */ already_AddRefed<FileDescriptorOutputStream>
FileDescriptorOutputStream::Create(const ipc::FileDescriptor& fileDescriptor)
{
if (NS_WARN_IF(!fileDescriptor.IsValid()))
return nullptr;
PRFileDesc* prfd = PR_ImportFile(PROsfd(fileDescriptor.PlatformHandle()));
if (NS_WARN_IF(!prfd))
return nullptr;
RefPtr<FileDescriptorOutputStream> stream = new FileDescriptorOutputStream(prfd);
return stream.forget();
}
NS_IMPL_ISUPPORTS(FileDescriptorOutputStream, nsIOutputStream);
NS_IMETHODIMP
FileDescriptorOutputStream::Close()
{
// Repeatedly closing is idempotent.
if (!fd)
return NS_OK;
if (PR_Close(fd) != PR_SUCCESS)
return NS_ERROR_FAILURE;
fd = nullptr;
return NS_OK;
}
NS_IMETHODIMP
FileDescriptorOutputStream::Write(const char* buf, uint32_t count, uint32_t* retval)
{
if (NS_WARN_IF(!fd))
return NS_ERROR_FAILURE;
auto written = PR_Write(fd, buf, count);
if (written < 0)
return NS_ERROR_FAILURE;
*retval = written;
return NS_OK;
}
NS_IMETHODIMP
FileDescriptorOutputStream::Flush()
{
if (NS_WARN_IF(!fd))
return NS_ERROR_FAILURE;
return PR_Sync(fd) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
FileDescriptorOutputStream::WriteFrom(nsIInputStream* fromStream, uint32_t count,
uint32_t* retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileDescriptorOutputStream::WriteSegments(nsReadSegmentFun reader, void* closure,
uint32_t count, uint32_t* retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileDescriptorOutputStream::IsNonBlocking(bool* retval)
{
*retval = false;
return NS_OK;
}
} // namespace devtools
} // namespace mozilla