Bug 1336182 - Part 2: Use "override" keyword to silence some warnings about inconsistency. r?drno draft
authorByron Campen [:bwc] <docfaraday@gmail.com>
Mon, 06 Feb 2017 16:44:14 -0600
changeset 479582 bf15d3aaac5c873909ebcb704a14f433f788067e
parent 479581 d5dd8fda7ef56b78226fec7c5bf9f6e636639cbf
child 544736 12212fead7ca0e2781a3b3d47d009bdcb1979ee9
push id44307
push userbcampen@mozilla.com
push dateTue, 07 Feb 2017 00:08:20 +0000
reviewersdrno
bugs1336182
milestone54.0a1
Bug 1336182 - Part 2: Use "override" keyword to silence some warnings about inconsistency. r?drno MozReview-Commit-ID: 1mVXvIGNBdr
media/mtransport/test/transport_unittests.cpp
media/mtransport/transportlayer.h
media/mtransport/transportlayerdtls.h
media/mtransport/transportlayerice.h
media/mtransport/transportlayerlog.h
media/mtransport/transportlayerloopback.h
media/mtransport/transportlayerprsock.h
--- a/media/mtransport/test/transport_unittests.cpp
+++ b/media/mtransport/test/transport_unittests.cpp
@@ -67,21 +67,21 @@ class TransportLayerDummy : public Trans
         destroyed_(destroyed) {
     *destroyed_ = false;
   }
 
   virtual ~TransportLayerDummy() {
     *destroyed_ = true;
   }
 
-  virtual nsresult InitInternal() {
+  nsresult InitInternal() override {
     return allow_init_ ? NS_OK : NS_ERROR_FAILURE;
   }
 
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len) {
+  TransportResult SendPacket(const unsigned char *data, size_t len) override {
     MOZ_CRASH();  // Should never be called.
     return 0;
   }
 
   TRANSPORT_LAYER_ID("lossy")
 
  private:
   bool allow_init_;
@@ -97,17 +97,17 @@ class Inspector {
 };
 
 // Class to simulate various kinds of network lossage
 class TransportLayerLossy : public TransportLayer {
  public:
   TransportLayerLossy() : loss_mask_(0), packet_(0), inspector_(nullptr) {}
   ~TransportLayerLossy () {}
 
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len) {
+  TransportResult SendPacket(const unsigned char *data, size_t len) override {
     MOZ_MTLOG(ML_NOTICE, LAYER_INFO << "SendPacket(" << len << ")");
 
     if (loss_mask_ & (1 << (packet_ % 32))) {
       MOZ_MTLOG(ML_NOTICE, "Dropping packet");
       ++packet_;
       return len;
     }
     if (inspector_) {
@@ -134,17 +134,17 @@ class TransportLayerLossy : public Trans
   void PacketReceived(TransportLayer *layer, const unsigned char *data,
                       size_t len) {
     SignalPacketReceived(this, data, len);
   }
 
   TRANSPORT_LAYER_ID("lossy")
 
  protected:
-  virtual void WasInserted() {
+  void WasInserted() override {
     downward_->SignalPacketReceived.
         connect(this,
                 &TransportLayerLossy::PacketReceived);
     downward_->SignalStateChange.
         connect(this,
                 &TransportLayerLossy::StateChange);
 
     TL_SET_STATE(downward_->state());
--- a/media/mtransport/transportlayer.h
+++ b/media/mtransport/transportlayer.h
@@ -24,17 +24,17 @@ class TransportFlow;
 
 typedef int TransportResult;
 
 enum {
   TE_WOULDBLOCK = -1, TE_ERROR = -2, TE_INTERNAL = -3
 };
 
 #define TRANSPORT_LAYER_ID(name) \
-  virtual const std::string id() const { return name; } \
+  const std::string id() const override { return name; } \
   static std::string ID() { return name; }
 
 // Abstract base class for network transport layers.
 class TransportLayer : public sigslot::has_slots<> {
  public:
   // The state of the transport flow
   // We can't use "ERROR" because Windows has a macro named "ERROR"
   enum State { TS_NONE, TS_INIT, TS_CONNECTING, TS_OPEN, TS_CLOSED, TS_ERROR };
--- a/media/mtransport/transportlayerdtls.h
+++ b/media/mtransport/transportlayerdtls.h
@@ -88,19 +88,19 @@ class TransportLayerDtls final : public 
 
   nsresult ExportKeyingMaterial(const std::string& label,
                                 bool use_context,
                                 const std::string& context,
                                 unsigned char *out,
                                 unsigned int outlen);
 
   // Transport layer overrides.
-  virtual nsresult InitInternal();
-  virtual void WasInserted();
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len);
+  nsresult InitInternal() override;
+  void WasInserted() override;
+  TransportResult SendPacket(const unsigned char *data, size_t len) override;
 
   // Signals
   void StateChange(TransportLayer *layer, State state);
   void PacketReceived(TransportLayer* layer, const unsigned char *data,
                       size_t len);
 
   // For testing use only.  Returns the fd.
   PRFileDesc* internal_fd() { CheckThread(); return ssl_fd_.get(); }
--- a/media/mtransport/transportlayerice.h
+++ b/media/mtransport/transportlayerice.h
@@ -37,17 +37,17 @@ class TransportLayerIce : public Transpo
   void SetParameters(RefPtr<NrIceCtx> ctx,
                      RefPtr<NrIceMediaStream> stream,
                      int component);
 
   void ResetOldStream(); // called after successful ice restart
   void RestoreOldStream(); // called after unsuccessful ice restart
 
   // Transport layer overrides.
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len);
+  TransportResult SendPacket(const unsigned char *data, size_t len) override;
 
   // Slots for ICE
   void IceCandidate(NrIceMediaStream *stream, const std::string&);
   void IceReady(NrIceMediaStream *stream);
   void IceFailed(NrIceMediaStream *stream);
   void IcePacketReceived(NrIceMediaStream *stream, int component,
                          const unsigned char *data, int len);
 
--- a/media/mtransport/transportlayerlog.h
+++ b/media/mtransport/transportlayerlog.h
@@ -15,27 +15,27 @@
 
 namespace mozilla {
 
 class TransportLayerLogging : public TransportLayer {
 public:
   TransportLayerLogging() {}
 
   // Overrides for TransportLayer
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len);
+  TransportResult SendPacket(const unsigned char *data, size_t len) override;
 
   // Signals (forwarded to upper layer)
   void StateChange(TransportLayer *layer, State state);
   void PacketReceived(TransportLayer* layer, const unsigned char *data,
                       size_t len);
 
   TRANSPORT_LAYER_ID("log")
 
 protected:
-  virtual void WasInserted();
+  void WasInserted() override;
 
 private:
   DISALLOW_COPY_ASSIGN(TransportLayerLogging);
 };
 
 
 }  // close namespace
 #endif
--- a/media/mtransport/transportlayerloopback.h
+++ b/media/mtransport/transportlayerloopback.h
@@ -66,17 +66,17 @@ class TransportLayerLoopback : public Tr
     if (peer) {
       peer->Disconnect();
     }
   }
 
   void CombinePackets(bool combine) { combinePackets_ = combine; }
 
   // Overrides for TransportLayer
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len);
+  TransportResult SendPacket(const unsigned char *data, size_t len) override;
 
   // Deliver queued packets
   void DeliverPackets();
 
   TRANSPORT_LAYER_ID("loopback")
 
  private:
   DISALLOW_COPY_ASSIGN(TransportLayerLoopback);
--- a/media/mtransport/transportlayerprsock.h
+++ b/media/mtransport/transportlayerprsock.h
@@ -28,26 +28,26 @@ class TransportLayerPrsock : public Tran
   TransportLayerPrsock() : fd_(nullptr), handler_() {}
 
   virtual ~TransportLayerPrsock() {
     Detach();
   }
 
 
   // Internal initializer
-  virtual nsresult InitInternal();
+  nsresult InitInternal() override;
 
   void Import(PRFileDesc *fd, nsresult *result);
 
   void Detach() {
     handler_->Detach();
   }
 
   // Implement TransportLayer
-  virtual TransportResult SendPacket(const unsigned char *data, size_t len);
+  TransportResult SendPacket(const unsigned char *data, size_t len) override;
 
   TRANSPORT_LAYER_ID("prsock")
 
  private:
   DISALLOW_COPY_ASSIGN(TransportLayerPrsock);
 
   // Inner class
   class SocketHandler : public nsASocketHandler {