Bug 1627390 - Add missing includes and namespaces to xpcom/io. r=xpcom-reviewers,sg
authorEric Rahm <erahm@mozilla.com>
Tue, 07 Apr 2020 19:09:47 +0000
changeset 522765 de63e64b9090789daea9ad11d3cd11b4f284afe5
parent 522764 5839dc2f9208bd391d57357309e8eb149abe050b
child 522766 96c239f49d62c553b600fa33592596553c60ad24
push id112290
push usererahm@mozilla.com
push dateTue, 07 Apr 2020 19:18:33 +0000
treeherderautoland@de63e64b9090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxpcom-reviewers, sg
bugs1627390
milestone77.0a1
first release with
nightly linux32
de63e64b9090 / 77.0a1 / 20200407214402 / files
nightly linux64
de63e64b9090 / 77.0a1 / 20200407214402 / files
nightly mac
de63e64b9090 / 77.0a1 / 20200407214402 / files
nightly win32
de63e64b9090 / 77.0a1 / 20200407214402 / files
nightly win64
de63e64b9090 / 77.0a1 / 20200407214402 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1627390 - Add missing includes and namespaces to xpcom/io. r=xpcom-reviewers,sg Differential Revision: https://phabricator.services.mozilla.com/D69656
xpcom/io/InputStreamLengthHelper.cpp
xpcom/io/InputStreamLengthHelper.h
xpcom/io/NonBlockingAsyncInputStream.cpp
xpcom/io/NonBlockingAsyncInputStream.h
xpcom/io/SnappyFrameUtils.h
xpcom/io/nsAnonymousTemporaryFile.h
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsAppFileLocationProvider.h
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsEscape.cpp
xpcom/io/nsScriptableInputStream.cpp
xpcom/io/nsSegmentedBuffer.cpp
xpcom/io/nsSegmentedBuffer.h
xpcom/io/nsStorageStream.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStringStream.cpp
--- a/xpcom/io/InputStreamLengthHelper.cpp
+++ b/xpcom/io/InputStreamLengthHelper.cpp
@@ -3,16 +3,18 @@
 /* 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 "InputStreamLengthHelper.h"
 #include "mozilla/dom/WorkerCommon.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIInputStream.h"
+#include "nsNetCID.h"
+#include "nsServiceManagerUtils.h"
 
 static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
 
 namespace mozilla {
 
 namespace {
 
 class AvailableEvent final : public Runnable {
--- a/xpcom/io/InputStreamLengthHelper.h
+++ b/xpcom/io/InputStreamLengthHelper.h
@@ -2,18 +2,21 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef mozilla_InputStreamLengthHelper_h
 #define mozilla_InputStreamLengthHelper_h
 
+#include <functional>
+
 #include "nsISupportsImpl.h"
 #include "nsIInputStreamLength.h"
+#include "nsThreadUtils.h"
 
 class nsIInputStream;
 
 namespace mozilla {
 
 // This class helps to retrieve the stream's length.
 
 class InputStreamLengthHelper final : public Runnable,
--- a/xpcom/io/NonBlockingAsyncInputStream.cpp
+++ b/xpcom/io/NonBlockingAsyncInputStream.cpp
@@ -1,15 +1,19 @@
 /* -*- Mode: C++; tab-width: 4; 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 "NonBlockingAsyncInputStream.h"
 #include "mozilla/ipc/InputStreamUtils.h"
+#include "nsIAsyncInputStream.h"
+#include "nsICloneableInputStream.h"
+#include "nsIInputStream.h"
+#include "nsIIPCSerializableInputStream.h"
 #include "nsISeekableStream.h"
 #include "nsStreamUtils.h"
 
 namespace mozilla {
 
 using namespace ipc;
 
 class NonBlockingAsyncInputStream::AsyncWaitRunnable final
--- a/xpcom/io/NonBlockingAsyncInputStream.h
+++ b/xpcom/io/NonBlockingAsyncInputStream.h
@@ -3,16 +3,17 @@
  * 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/. */
 
 #ifndef NonBlockingAsyncInputStream_h
 #define NonBlockingAsyncInputStream_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/Mutex.h"
 #include "nsCOMPtr.h"
 #include "nsIAsyncInputStream.h"
 #include "nsICloneableInputStream.h"
 #include "nsIIPCSerializableInputStream.h"
 #include "nsISeekableStream.h"
 
 // This class aims to wrap a non-blocking and non-async inputStream and expose
 // it as nsIAsyncInputStream.
--- a/xpcom/io/SnappyFrameUtils.h
+++ b/xpcom/io/SnappyFrameUtils.h
@@ -2,16 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef mozilla_SnappyFrameUtils_h__
 #define mozilla_SnappyFrameUtils_h__
 
+#include <cstddef>
+
 #include "mozilla/Attributes.h"
 #include "nsError.h"
 
 namespace mozilla {
 namespace detail {
 
 //
 // Utility class providing primitives necessary to build streams based
--- a/xpcom/io/nsAnonymousTemporaryFile.h
+++ b/xpcom/io/nsAnonymousTemporaryFile.h
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #pragma once
 
 #include "prio.h"
 #include "nscore.h"
+#include "nsIFile.h"
 
 /**
  * OpenAnonymousTemporaryFile
  *
  * Creates and opens a temporary file which has a random name. Callers have no
  * control over the file name, and the file is opened in a temporary location
  * which is appropriate for the platform.
  *
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -4,16 +4,17 @@
  * 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 "nsAppFileLocationProvider.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsEnumeratorUtils.h"
 #include "nsAtom.h"
+#include "nsIDirectoryService.h"
 #include "nsIFile.h"
 #include "nsString.h"
 #include "nsSimpleEnumerator.h"
 #include "prenv.h"
 #include "nsCRT.h"
 #if defined(MOZ_WIDGET_COCOA)
 #  include <Carbon/Carbon.h>
 #  include "nsILocalFileMac.h"
--- a/xpcom/io/nsAppFileLocationProvider.h
+++ b/xpcom/io/nsAppFileLocationProvider.h
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #ifndef nsAppFileLocationProvider_h
 #define nsAppFileLocationProvider_h
 
 #include "nsIDirectoryService.h"
+#include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsIFile;
 
 //*****************************************************************************
 // class nsAppFileLocationProvider
 //*****************************************************************************
 
--- a/xpcom/io/nsBinaryStream.cpp
+++ b/xpcom/io/nsBinaryStream.cpp
@@ -771,17 +771,17 @@ nsBinaryInputStream::ReadBytes(uint32_t 
 
   *aResult = s;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadByteArray(uint32_t aLength,
                                    nsTArray<uint8_t>& aResult) {
-  if (!aResult.SetLength(aLength, fallible)) {
+  if (!aResult.SetLength(aLength, mozilla::fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   nsresult rv = ReadBytesToBuffer(aLength, aResult.Elements());
   if (NS_FAILED(rv)) {
     aResult.Clear();
   }
   return rv;
 }
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -7,16 +7,17 @@
 #include "mozilla/ArrayUtils.h"
 
 #include "nsCOMPtr.h"
 #include "nsDirectoryService.h"
 #include "nsLocalFile.h"
 #include "nsDebug.h"
 #include "nsGkAtoms.h"
 #include "nsEnumeratorUtils.h"
+#include "nsThreadUtils.h"
 
 #include "mozilla/SimpleEnumerator.h"
 #include "nsICategoryManager.h"
 #include "nsISimpleEnumerator.h"
 
 #if defined(XP_WIN)
 #  include <windows.h>
 #  include <shlobj.h>
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -388,17 +388,17 @@ bool NS_EscapeURL(const char* aPart, int
                   nsACString& aResult) {
   size_t partLen;
   if (aPartLen < 0) {
     partLen = strlen(aPart);
   } else {
     partLen = aPartLen;
   }
 
-  return NS_EscapeURLSpan(MakeSpan(aPart, partLen), aFlags, aResult);
+  return NS_EscapeURLSpan(mozilla::MakeSpan(aPart, partLen), aFlags, aResult);
 }
 
 bool NS_EscapeURLSpan(mozilla::Span<const char> aStr, uint32_t aFlags,
                       nsACString& aResult) {
   bool appended = false;
   nsresult rv = T_EscapeURL(aStr.Elements(), aStr.Length(), aFlags, nullptr,
                             aResult, appended);
   if (NS_FAILED(rv)) {
@@ -433,17 +433,17 @@ nsresult NS_EscapeAndFilterURL(const nsA
   nsresult rv = T_EscapeURL(aStr.Data(), aStr.Length(), aFlags, aFilterMask,
                             aResult, appended);
   if (NS_FAILED(rv)) {
     aResult.Truncate();
     return rv;
   }
 
   if (!appended) {
-    if (!aResult.Assign(aStr, fallible)) {
+    if (!aResult.Assign(aStr, mozilla::fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
 
   return rv;
 }
 
 const nsAString& NS_EscapeURL(const nsAString& aStr, uint32_t aFlags,
--- a/xpcom/io/nsScriptableInputStream.cpp
+++ b/xpcom/io/nsScriptableInputStream.cpp
@@ -71,17 +71,17 @@ nsScriptableInputStream::Read(uint32_t a
 }
 
 NS_IMETHODIMP
 nsScriptableInputStream::ReadBytes(uint32_t aCount, nsACString& aResult) {
   if (!mInputStream) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
-  if (!aResult.SetLength(aCount, fallible)) {
+  if (!aResult.SetLength(aCount, mozilla::fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   MOZ_ASSERT(aResult.Length() == aCount);
   char* ptr = aResult.BeginWriting();
   nsresult rv = ReadHelper(ptr, aCount);
   if (NS_FAILED(rv)) {
     aResult.Truncate();
--- a/xpcom/io/nsSegmentedBuffer.cpp
+++ b/xpcom/io/nsSegmentedBuffer.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsSegmentedBuffer.h"
 #include "nsMemory.h"
+#include "nsNetCID.h"
+#include "nsServiceManagerUtils.h"
+#include "nsThreadUtils.h"
 
 nsresult nsSegmentedBuffer::Init(uint32_t aSegmentSize, uint32_t aMaxSize) {
   if (mSegmentArrayCount != 0) {
     return NS_ERROR_FAILURE;  // initialized more than once
   }
   mSegmentSize = aSegmentSize;
   mMaxSize = aMaxSize;
 #if 0  // testing...
--- a/xpcom/io/nsSegmentedBuffer.h
+++ b/xpcom/io/nsSegmentedBuffer.h
@@ -2,16 +2,22 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsSegmentedBuffer_h__
 #define nsSegmentedBuffer_h__
 
+#include <stddef.h>
+
+#include "nsCOMPtr.h"
+#include "nsDebug.h"
+#include "nsError.h"
+
 class nsIEventTarget;
 
 class nsSegmentedBuffer {
  public:
   nsSegmentedBuffer()
       : mSegmentSize(0),
         mMaxSize(0),
         mSegmentArray(nullptr),
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -38,17 +38,17 @@ using mozilla::ipc::StringInputStreamPar
 // To enable logging (see prlog.h for full details):
 //
 //    set MOZ_LOG=StorageStreamLog:5
 //    set MOZ_LOG_FILE=storage.log
 //
 // This enables LogLevel::Debug level information and places all output in
 // the file storage.log.
 //
-static LazyLogModule sStorageStreamLog("nsStorageStream");
+static mozilla::LazyLogModule sStorageStreamLog("nsStorageStream");
 #ifdef LOG
 #  undef LOG
 #endif
 #define LOG(args) MOZ_LOG(sStorageStreamLog, mozilla::LogLevel::Debug, args)
 
 nsStorageStream::nsStorageStream()
     : mSegmentedBuffer(0),
       mSegmentSize(0),
@@ -572,18 +572,18 @@ void nsStorageInputStream::SerializeInte
   MOZ_ASSERT(aSizeUsed);
   *aSizeUsed = 0;
 
   uint64_t remaining = 0;
   nsresult rv = Available(&remaining);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   if (remaining >= aMaxSize) {
-    InputStreamHelper::SerializeInputStreamAsPipe(this, aParams, aDelayedStart,
-                                                  aManager);
+    mozilla::ipc::InputStreamHelper::SerializeInputStreamAsPipe(
+        this, aParams, aDelayedStart, aManager);
     return;
   }
 
   *aSizeUsed = remaining;
 
   nsCString combined;
   int64_t offset;
   rv = Tell(&offset);
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -11,16 +11,17 @@
 #include "nsICloneableInputStream.h"
 #include "nsIEventTarget.h"
 #include "nsICancelableRunnable.h"
 #include "nsISafeOutputStream.h"
 #include "nsString.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsIBufferedStreams.h"
+#include "nsIPipe.h"
 #include "nsNetCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsITransport.h"
 #include "nsIStreamTransportService.h"
 #include "NonBlockingAsyncInputStream.h"
 
 using namespace mozilla;
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -23,17 +23,20 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "nsIIPCSerializableInputStream.h"
 #include "XPCOMModule.h"
 
 using namespace mozilla::ipc;
+using mozilla::fallible;
+using mozilla::MallocSizeOf;
 using mozilla::Maybe;
+using mozilla::ReentrantMonitorAutoEnter;
 using mozilla::Some;
 
 //-----------------------------------------------------------------------------
 // nsIStringInputStream implementation
 //-----------------------------------------------------------------------------
 
 class nsStringInputStream final : public nsIStringInputStream,
                                   public nsISeekableStream,
@@ -466,17 +469,17 @@ nsStringInputStream::Clone(nsIInputStrea
   // mOffset is overwritten by SetData().
   ref->mOffset = mOffset;
 
   ref.forget(aCloneOut);
   return NS_OK;
 }
 
 nsresult NS_NewByteInputStream(nsIInputStream** aStreamResult,
-                               Span<const char> aStringToRead,
+                               mozilla::Span<const char> aStringToRead,
                                nsAssignmentType aAssignment) {
   MOZ_ASSERT(aStreamResult, "null out ptr");
 
   RefPtr<nsStringInputStream> stream = new nsStringInputStream();
 
   nsresult rv;
   switch (aAssignment) {
     case NS_ASSIGNMENT_COPY: