Bug 1414767 - Moving SlicedInputStream under mozilla namespace, r=froydnj
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 07 Nov 2017 01:04:06 +0100
changeset 390337 4f5a502acbe831a1d17d5af06efd63c0b3081a8e
parent 390336 b1ce6a65a2141c6ad7f8b3c83333878d976f75c2
child 390338 e4815e8465a2cc7d09d479dd76e7143a09927fd3
push id97034
push useramarchesini@mozilla.com
push dateTue, 07 Nov 2017 00:04:31 +0000
treeherdermozilla-inbound@4f5a502acbe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1414767
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414767 - Moving SlicedInputStream under mozilla namespace, r=froydnj
dom/file/FileBlobImpl.cpp
dom/file/ipc/IPCBlobInputStream.cpp
ipc/glue/InputStreamUtils.cpp
xpcom/io/SlicedInputStream.cpp
xpcom/io/SlicedInputStream.h
xpcom/io/moz.build
xpcom/tests/gtest/TestSlicedInputStream.cpp
--- a/dom/file/FileBlobImpl.cpp
+++ b/dom/file/FileBlobImpl.cpp
@@ -1,24 +1,24 @@
 /* -*- 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 "FileBlobImpl.h"
+#include "mozilla/SlicedInputStream.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerRunnable.h"
 #include "nsCExternalHandlerService.h"
 #include "nsIFile.h"
 #include "nsIFileStreams.h"
 #include "nsIMIMEService.h"
 #include "nsNetUtil.h"
 #include "nsStreamUtils.h"
-#include "SlicedInputStream.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace workers;
 
 NS_IMPL_ISUPPORTS_INHERITED0(FileBlobImpl, BlobImpl)
 
--- a/dom/file/ipc/IPCBlobInputStream.cpp
+++ b/dom/file/ipc/IPCBlobInputStream.cpp
@@ -3,23 +3,23 @@
 /* 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 "IPCBlobInputStream.h"
 #include "IPCBlobInputStreamChild.h"
 #include "IPCBlobInputStreamStorage.h"
 #include "mozilla/ipc/InputStreamParams.h"
+#include "mozilla/SlicedInputStream.h"
 #include "IPCBlobInputStreamThread.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsIPipe.h"
 #include "nsStreamUtils.h"
 #include "nsStringStream.h"
-#include "SlicedInputStream.h"
 
 namespace mozilla {
 namespace dom {
 
 namespace {
 
 class InputStreamCallbackRunnable final : public CancelableRunnable
 {
--- a/ipc/glue/InputStreamUtils.cpp
+++ b/ipc/glue/InputStreamUtils.cpp
@@ -7,26 +7,26 @@
 #include "InputStreamUtils.h"
 
 #include "nsIIPCSerializableInputStream.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/ipc/IPCBlobInputStream.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
+#include "mozilla/SlicedInputStream.h"
 #include "nsComponentManagerUtils.h"
 #include "nsDebug.h"
 #include "nsID.h"
 #include "nsIXULRuntime.h"
 #include "nsMIMEInputStream.h"
 #include "nsMultiplexInputStream.h"
 #include "nsNetCID.h"
 #include "nsStringStream.h"
 #include "nsXULAppAPI.h"
-#include "SlicedInputStream.h"
 
 using namespace mozilla::dom;
 
 namespace {
 
 NS_DEFINE_CID(kStringInputStreamCID, NS_STRINGINPUTSTREAM_CID);
 NS_DEFINE_CID(kFileInputStreamCID, NS_LOCALFILEINPUTSTREAM_CID);
 NS_DEFINE_CID(kBufferedInputStreamCID, NS_BUFFEREDINPUTSTREAM_CID);
@@ -92,17 +92,17 @@ InputStreamHelper::DeserializeInputStrea
       serializable = do_CreateInstance(kMIMEInputStreamCID);
       break;
 
     case InputStreamParams::TMultiplexInputStreamParams:
       serializable = do_CreateInstance(kMultiplexInputStreamCID);
       break;
 
     case InputStreamParams::TSlicedInputStreamParams:
-      serializable = new SlicedInputStream();
+      serializable = new mozilla::SlicedInputStream();
       break;
 
     default:
       MOZ_ASSERT(false, "Unknown params!");
       return nullptr;
   }
 
   MOZ_ASSERT(serializable);
--- a/xpcom/io/SlicedInputStream.cpp
+++ b/xpcom/io/SlicedInputStream.cpp
@@ -4,17 +4,19 @@
  * 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 "SlicedInputStream.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "nsISeekableStream.h"
 #include "nsStreamUtils.h"
 
-using namespace mozilla::ipc;
+namespace mozilla {
+
+using namespace ipc;
 
 NS_IMPL_ADDREF(SlicedInputStream);
 NS_IMPL_RELEASE(SlicedInputStream);
 
 NS_INTERFACE_MAP_BEGIN(SlicedInputStream)
   NS_INTERFACE_MAP_ENTRY(nsIInputStream)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsICloneableInputStream,
                                      mWeakCloneableInputStream || !mInputStream)
@@ -506,8 +508,10 @@ NS_IMETHODIMP
 SlicedInputStream::SetEOF()
 {
   NS_ENSURE_STATE(mInputStream);
   NS_ENSURE_STATE(mWeakSeekableInputStream);
 
   mClosed = true;
   return mWeakSeekableInputStream->SetEOF();
 }
+
+} // namespace mozilla
--- a/xpcom/io/SlicedInputStream.h
+++ b/xpcom/io/SlicedInputStream.h
@@ -9,16 +9,18 @@
 
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
 #include "nsIAsyncInputStream.h"
 #include "nsICloneableInputStream.h"
 #include "nsIIPCSerializableInputStream.h"
 #include "nsISeekableStream.h"
 
+namespace mozilla {
+
 // A wrapper for a slice of an underlying input stream.
 
 class SlicedInputStream final : public nsIAsyncInputStream
                               , public nsICloneableInputStream
                               , public nsIIPCSerializableInputStream
                               , public nsISeekableStream
                               , public nsIInputStreamCallback
 {
@@ -73,9 +75,11 @@ private:
 
   // These four are used for AsyncWait.
   nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback;
   nsCOMPtr<nsIEventTarget> mAsyncWaitEventTarget;
   uint32_t mAsyncWaitFlags;
   uint32_t mAsyncWaitRequestedCount;
 };
 
+} // mozilla namespace
+
 #endif // SlicedInputStream_h
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -73,22 +73,22 @@ EXPORTS += [
     'nsMultiplexInputStream.h',
     'nsNativeCharsetUtils.h',
     'nsScriptableInputStream.h',
     'nsStorageStream.h',
     'nsStreamUtils.h',
     'nsStringStream.h',
     'nsUnicharInputStream.h',
     'nsWildCard.h',
-    'SlicedInputStream.h',
     'SpecialSystemDirectory.h',
 ]
 
 EXPORTS.mozilla += [
     'Base64.h',
+    'SlicedInputStream.h',
     'SnappyCompressOutputStream.h',
     'SnappyFrameUtils.h',
     'SnappyUncompressInputStream.h',
 ]
 
 UNIFIED_SOURCES += [
     'Base64.cpp',
     'crc32c.c',
--- a/xpcom/tests/gtest/TestSlicedInputStream.cpp
+++ b/xpcom/tests/gtest/TestSlicedInputStream.cpp
@@ -1,19 +1,21 @@
 #include "gtest/gtest.h"
 
+#include "mozilla/SlicedInputStream.h"
 #include "nsCOMPtr.h"
 #include "nsIInputStream.h"
 #include "nsIPipe.h"
 #include "nsStreamUtils.h"
 #include "nsString.h"
 #include "nsStringStream.h"
-#include "SlicedInputStream.h"
 #include "Helpers.h"
 
+using namespace mozilla;
+
 // This helper class is used to call OnInputStreamReady with the right stream
 // as argument.
 class InputStreamCallback final : public nsIInputStreamCallback
 {
   nsCOMPtr<nsIAsyncInputStream> mStream;
   nsCOMPtr<nsIInputStreamCallback> mCallback;
 
 public: