DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (e67641c2e4cc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#ifndef nricectxhandler_h__
#define nricectxhandler_h__

#include "nricectx.h"

namespace mozilla {

class NrIceCtxHandler {
 public:
  // TODO(ekr@rtfm.com): Too many bools here. Bug 1193437.
  static RefPtr<NrIceCtxHandler> Create(
      const std::string& name, bool allow_loopback = false,
      bool tcp_enabled = true, bool allow_link_local = false,
      NrIceCtx::Policy policy = NrIceCtx::ICE_POLICY_ALL);

  RefPtr<NrIceMediaStream> CreateStream(const std::string& name,
                                        int components);
  // CreateCtx is necessary so we can create and initialize the context
  // on main thread, but begin the ice restart mechanics on STS thread
  RefPtr<NrIceCtx> CreateCtx() const;  // for test
  RefPtr<NrIceCtx> CreateCtx(const std::string& ufrag,
                             const std::string& pwd) const;

  RefPtr<NrIceCtx> ctx() { return current_ctx; }

  bool BeginIceRestart(RefPtr<NrIceCtx> new_ctx);
  bool IsRestarting() const { return (old_ctx != nullptr); }
  void FinalizeIceRestart();
  void RollbackIceRestart();

  NrIceStats Destroy();

  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NrIceCtxHandler)

 private:
  NrIceCtxHandler(const std::string& name, NrIceCtx::Policy policy);
  NrIceCtxHandler() = delete;
  ~NrIceCtxHandler();
  DISALLOW_COPY_ASSIGN(NrIceCtxHandler);

  RefPtr<NrIceCtx> current_ctx;
  RefPtr<NrIceCtx> old_ctx;  // for while restart is in progress
  int restart_count;  // used to differentiate streams between restarted ctx
};

}  // namespace mozilla

#endif  // nricectxhandler_h__