Bug 1406819 - Remove various bits of dead code from dom/. r=baku
authorJonathan Watt <jwatt@jwatt.org>
Mon, 25 Sep 2017 09:20:53 +0100
changeset 385534 73c1f78f0040ede8058e0dac7102c5dec7687b72
parent 385533 c7c66aac19da126fee814dcf6b22f38bc1ed60e0
child 385535 4d7ad98e5be6d28138573e77828218ffd3081c8f
push id32662
push userryanvm@gmail.com
push dateWed, 11 Oct 2017 21:53:47 +0000
treeherdermozilla-central@3d918ff5d634 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1406819
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 1406819 - Remove various bits of dead code from dom/. r=baku Differential Revision: https://phabricator.services.mozilla.com/D109
dom/base/nsJSEnvironment.cpp
dom/base/nsJSTimeoutHandler.cpp
dom/canvas/WebGLContextValidate.cpp
dom/canvas/WebGLTextureUpload.cpp
dom/encoding/TextDecoder.cpp
dom/html/HTMLInputElement.cpp
dom/html/nsTextEditorState.cpp
dom/media/CubebUtils.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDeviceInfo.cpp
dom/media/MediaRecorder.cpp
dom/media/StreamTracks.cpp
dom/media/encoder/TrackEncoder.cpp
dom/media/platforms/PDMFactory.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
dom/storage/LocalStorage.cpp
dom/storage/Storage.cpp
dom/xslt/xpath/XPathEvaluator.cpp
layout/build/nsLayoutModule.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -571,18 +571,16 @@ void
 DumpString(const nsAString &str)
 {
   printf("%s\n", NS_ConvertUTF16toUTF8(str).get());
 }
 #endif
 
 #define JS_OPTIONS_DOT_STR "javascript.options."
 
-static const char js_options_dot_str[]   = JS_OPTIONS_DOT_STR;
-
 nsJSContext::nsJSContext(bool aGCOnDestruction,
                          nsIScriptGlobalObject* aGlobalObject)
   : mWindowProxy(nullptr)
   , mGCOnDestruction(aGCOnDestruction)
   , mGlobalObjectRef(aGlobalObject)
 {
   EnsureStatics();
 
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -16,19 +16,16 @@
 #include "nsGlobalWindow.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIDocument.h"
 #include "nsIScriptTimeoutHandler.h"
 #include "nsIXPConnect.h"
 #include "nsJSUtils.h"
 #include "WorkerPrivate.h"
 
-static const char kSetIntervalStr[] = "setInterval";
-static const char kSetTimeoutStr[] = "setTimeout";
-
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::workers;
 
 // Our JS nsIScriptTimeoutHandler implementation.
 class nsJSScriptTimeoutHandler final : public nsIScriptTimeoutHandler
 {
 public:
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -384,29 +384,16 @@ WebGLContext::ValidateStencilParamsForDr
     if (mStencilWriteMaskFront != mStencilWriteMaskBack) {
         ErrorInvalidOperation(msg, "stencilMaskSeparate", "write masks");
         return false;
     }
 
     return true;
 }
 
-static inline int32_t
-FloorPOT(int32_t x)
-{
-    MOZ_ASSERT(x > 0);
-    int32_t pot = 1;
-    while (pot < 0x40000000) {
-        if (x < pot*2)
-            break;
-        pot *= 2;
-    }
-    return pot;
-}
-
 bool
 WebGLContext::InitAndValidateGL(FailureReason* const out_failReason)
 {
     MOZ_RELEASE_ASSERT(gl, "GFX: GL not initialized");
 
     // Unconditionally create a new format usage authority. This is
     // important when restoring contexts and extensions need to add
     // formats back into the authority.
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -932,31 +932,16 @@ DoCompressedTexSubImage(gl::GLContext* g
         gl->fCompressedTexSubImage2D(target.get(), level, xOffset, yOffset, width,
                                      height, sizedUnpackFormat, dataSize, data);
     }
 
     return errorScope.GetError();
 }
 
 static inline GLenum
-DoCopyTexImage2D(gl::GLContext* gl, TexImageTarget target, GLint level,
-                 GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    const GLint border = 0;
-
-    gl::GLContext::LocalErrorScope errorScope(*gl);
-
-    MOZ_ASSERT(!IsTarget3D(target));
-    gl->fCopyTexImage2D(target.get(), level, internalFormat, x, y, width, height,
-                        border);
-
-    return errorScope.GetError();
-}
-
-static inline GLenum
 DoCopyTexSubImage(gl::GLContext* gl, TexImageTarget target, GLint level, GLint xOffset,
                   GLint yOffset, GLint zOffset, GLint x, GLint y, GLsizei width,
                   GLsizei height)
 {
     gl::GLContext::LocalErrorScope errorScope(*gl);
 
     if (IsTarget3D(target)) {
         gl->fCopyTexSubImage3D(target.get(), level, xOffset, yOffset, zOffset, x, y,
--- a/dom/encoding/TextDecoder.cpp
+++ b/dom/encoding/TextDecoder.cpp
@@ -9,18 +9,16 @@
 #include "mozilla/Encoding.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "nsContentUtils.h"
 #include <stdint.h>
 
 namespace mozilla {
 namespace dom {
 
-static const char16_t kReplacementChar = static_cast<char16_t>(0xFFFD);
-
 void
 TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
                   ErrorResult& aRv)
 {
   // Let encoding be the result of getting an encoding from label.
   // If encoding is failure or replacement, throw a RangeError
   // (https://encoding.spec.whatwg.org/#dom-textdecoder).
   const Encoding* encoding = Encoding::ForLabelNoReplacement(aLabel);
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -222,19 +222,16 @@ const double HTMLInputElement::kMsPerDay
 #define NS_INPUT_ELEMENT_STATE_IID                 \
 { /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */       \
   0xdc3b3d14,                                      \
   0x23e2,                                          \
   0x4479,                                          \
   {0xb5, 0x13, 0x7b, 0x36, 0x93, 0x43, 0xe3, 0xa0} \
 }
 
-#define PROGRESS_STR "progress"
-static const uint32_t kProgressEventInterval = 50; // ms
-
 // An helper class for the dispatching of the 'change' event.
 // This class is used when the FilePicker finished its task (or when files and
 // directories are set by some chrome/test only method).
 // The task of this class is to postpone the dispatching of 'change' and 'input'
 // events at the end of the exploration of the directories.
 class DispatchChangeEventCallback final : public GetFilesCallback
 {
 public:
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -48,18 +48,16 @@
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/layers/ScrollInputMethods.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using mozilla::layers::ScrollInputMethod;
 
-static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
-
 class MOZ_STACK_CLASS ValueSetter
 {
 public:
   explicit ValueSetter(TextEditor* aTextEditor)
     : mTextEditor(aTextEditor)
     // To protect against a reentrant call to SetValue, we check whether
     // another SetValue is already happening for this editor.  If it is,
     // we must wait until we unwind to re-enable oninput events.
--- a/dom/media/CubebUtils.cpp
+++ b/dom/media/CubebUtils.cpp
@@ -184,18 +184,16 @@ uint32_t sPreferredSampleRate;
 
 // We only support SMPTE layout in cubeb for now. If the value is
 // CUBEB_LAYOUT_UNDEFINED, then it implies that the preferred layout is
 // non-SMPTE format.
 cubeb_channel_layout sPreferredChannelLayout;
 
 } // namespace
 
-extern LazyLogModule gAudioStreamLog;
-
 static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100;
 // Consevative default that can work on all platforms.
 static const uint32_t CUBEB_NORMAL_LATENCY_FRAMES = 1024;
 
 namespace CubebUtils {
 
 void PrefChanged(const char* aPref, void* aClosure)
 {
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -99,22 +99,16 @@ static constexpr auto AMPLE_AUDIO_THRESH
 
 } // namespace detail
 
 // If we have fewer than LOW_VIDEO_FRAMES decoded frames, and
 // we're not "prerolling video", we'll skip the video up to the next keyframe
 // which is at or after the current playback position.
 static const uint32_t LOW_VIDEO_FRAMES = 2;
 
-// Threshold that used to check if we are low on decoded video.
-// If the last video frame's end time |mDecodedVideoEndTime| is more than
-// |LOW_VIDEO_THRESHOLD*mPlaybackRate| after the current clock in
-// Advanceframe(), the video decode is lagging, and we skip to next keyframe.
-static constexpr auto LOW_VIDEO_THRESHOLD = TimeUnit::FromMicroseconds(60000);
-
 // Arbitrary "frame duration" when playing only audio.
 static const int AUDIO_DURATION_USECS = 40000;
 
 namespace detail {
 
 // If we have less than this much buffered data available, we'll consider
 // ourselves to be running low on buffered data. We determine how much
 // buffered data we have remaining using the reader's GetBuffered()
--- a/dom/media/MediaDeviceInfo.cpp
+++ b/dom/media/MediaDeviceInfo.cpp
@@ -55,13 +55,11 @@ void MediaDeviceInfo::GetGroupId(nsStrin
 }
 
 void MediaDeviceInfo::GetLabel(nsString& retval)
 {
   retval = mLabel;
 }
 
 MediaDeviceKind Kind();
-void GetLabel(nsString& retval);
-void GetGroupId(nsString& retval);
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -1430,21 +1430,16 @@ MediaRecorder::SetOptions(const MediaRec
   //
   // Until dynamic changes are supported, I prefer to be safe and err
   // slightly high
   if (aInitDict.mBitsPerSecond.WasPassed() && !aInitDict.mVideoBitsPerSecond.WasPassed()) {
     mVideoBitsPerSecond = mBitsPerSecond;
   }
 }
 
-static char const *const gWebMAudioEncoderCodecs[2] = {
-  "opus",
-  // no VP9 yet
-  nullptr,
-};
 static char const *const gWebMVideoEncoderCodecs[4] = {
   "opus",
   "vp8",
   "vp8.0",
   // no VP9 yet
   nullptr,
 };
 static char const *const gOggAudioEncoderCodecs[2] = {
--- a/dom/media/StreamTracks.cpp
+++ b/dom/media/StreamTracks.cpp
@@ -4,20 +4,21 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "StreamTracks.h"
 #include "mozilla/Logging.h"
 #include <algorithm>
 
 namespace mozilla {
 
+#ifdef DEBUG
+
 extern LazyLogModule gMediaStreamGraphLog;
 #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
 
-#ifdef DEBUG
 void
 StreamTracks::DumpTrackInfo() const
 {
   STREAM_LOG(LogLevel::Info, ("DumpTracks: mTracksKnownTime %" PRId64, mTracksKnownTime));
   for (uint32_t i = 0; i < mTracks.Length(); ++i) {
     Track* track = mTracks[i];
     if (track->IsEnded()) {
       STREAM_LOG(LogLevel::Info, ("Track[%d] %d: ended", i, track->GetID()));
--- a/dom/media/encoder/TrackEncoder.cpp
+++ b/dom/media/encoder/TrackEncoder.cpp
@@ -18,17 +18,16 @@ namespace mozilla {
 
 LazyLogModule gTrackEncoderLog("TrackEncoder");
 #define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg)
 
 static const int DEFAULT_CHANNELS = 1;
 static const int DEFAULT_SAMPLING_RATE = 16000;
 static const int DEFAULT_FRAME_WIDTH = 640;
 static const int DEFAULT_FRAME_HEIGHT = 480;
-static const int DEFAULT_TRACK_RATE = USECS_PER_S;
 // 1 second threshold if the audio encoder cannot be initialized.
 static const int AUDIO_INIT_FAILED_DURATION = 1;
 // 30 second threshold if the video encoder cannot be initialized.
 static const int VIDEO_INIT_FAILED_DURATION = 30;
 
 TrackEncoder::TrackEncoder(TrackRate aTrackRate)
   : mEncodingComplete(false)
   , mEosSetInEncoder(false)
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -44,17 +44,16 @@
 #include "mozilla/dom/RemoteVideoDecoder.h"
 
 #include "mp4_demuxer/H264.h"
 
 #include <functional>
 
 namespace mozilla {
 
-extern already_AddRefed<PlatformDecoderModule> CreateAgnosticDecoderModule();
 extern already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule();
 extern already_AddRefed<PlatformDecoderModule> CreateNullDecoderModule();
 
 class PDMFactoryImpl final
 {
 public:
   PDMFactoryImpl()
   {
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -38,18 +38,16 @@
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 using namespace mozilla;
 using namespace mozilla::plugins::parent;
 using namespace mozilla::layers;
 
-static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
-
 NS_IMPL_ISUPPORTS(nsNPAPIPluginInstance, nsIAudioChannelAgentCallback)
 
 nsNPAPIPluginInstance::nsNPAPIPluginInstance()
   : mDrawingModel(kDefaultDrawingModel)
   , mRunning(NOT_STARTED)
   , mWindowless(false)
   , mTransparent(false)
   , mCached(false)
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -610,27 +610,16 @@ PluginInstanceParent::DeallocPStreamNoti
 
 mozilla::ipc::IPCResult
 PluginInstanceParent::RecvNPN_InvalidateRect(const NPRect& rect)
 {
     mNPNIface->invalidaterect(mNPP, const_cast<NPRect*>(&rect));
     return IPC_OK();
 }
 
-static inline NPRect
-IntRectToNPRect(const gfx::IntRect& rect)
-{
-    NPRect r;
-    r.left = rect.x;
-    r.top = rect.y;
-    r.right = rect.x + rect.width;
-    r.bottom = rect.y + rect.height;
-    return r;
-}
-
 mozilla::ipc::IPCResult
 PluginInstanceParent::RecvRevokeCurrentDirectSurface()
 {
     ImageContainer *container = GetImageContainer();
     if (!container) {
         return IPC_OK();
     }
 
--- a/dom/storage/LocalStorage.cpp
+++ b/dom/storage/LocalStorage.cpp
@@ -239,19 +239,16 @@ LocalStorage::ApplyEvent(StorageEvent* a
     mCache->RemoveItem(this, key, old, LocalStorageCache::E10sPropagated);
     return;
   }
 
   // Otherwise, we set the new value.
   mCache->SetItem(this, key, value, old, LocalStorageCache::E10sPropagated);
 }
 
-static const char kPermissionType[] = "cookie";
-static const char kStorageEnabled[] = "dom.storage.enabled";
-
 bool
 LocalStorage::PrincipalEquals(nsIPrincipal* aPrincipal)
 {
   return StorageUtils::PrincipalsEqual(mPrincipal, aPrincipal);
 }
 
 void
 LocalStorage::GetSupportedNames(nsTArray<nsString>& aKeys)
--- a/dom/storage/Storage.cpp
+++ b/dom/storage/Storage.cpp
@@ -9,16 +9,18 @@
 
 #include "mozilla/dom/StorageBinding.h"
 #include "nsIPrincipal.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
+static const char kStorageEnabled[] = "dom.storage.enabled";
+
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Storage, mWindow, mPrincipal)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Storage)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Storage)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Storage)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage)
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -19,21 +19,16 @@
 #include "nsDOMString.h"
 #include "nsNameSpaceManager.h"
 #include "nsContentUtils.h"
 #include "txIXPathContext.h"
 #include "mozilla/dom/XPathEvaluatorBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/XPathNSResolverBinding.h"
 
-extern nsresult
-TX_ResolveFunctionCallXPCOM(const nsCString &aContractID, int32_t aNamespaceID,
-                            nsAtom *aName, nsISupports *aState,
-                            FunctionCall **aFunction);
-
 namespace mozilla {
 namespace dom {
 
 // txIParseContext implementation
 class XPathEvaluatorParseContext : public txIParseContext
 {
 public:
     XPathEvaluatorParseContext(XPathNSResolver* aResolver,
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -356,18 +356,16 @@ nsresult NS_NewTreeBoxObject(nsIBoxObjec
 #endif
 
 nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
 
 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
 
 nsresult NS_NewDomSelection(nsISelection** aResult);
 already_AddRefed<nsIContentViewer> NS_NewContentViewer();
-nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
-nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
 nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
 
 nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
 nsresult NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult);
 nsresult NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult);