LCOV - code coverage report
Current view: top level - netwerk/dns - DNSListenerProxy.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* vim: set sw=4 ts=8 et tw=80 : */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef DNSListenerProxy_h__
       8             : #define DNSListenerProxy_h__
       9             : 
      10             : #include "nsIDNSListener.h"
      11             : #include "nsIDNSRecord.h"
      12             : #include "nsProxyRelease.h"
      13             : #include "nsThreadUtils.h"
      14             : 
      15             : class nsIEventTarget;
      16             : class nsICancelable;
      17             : 
      18             : namespace mozilla {
      19             : namespace net {
      20             : 
      21             : class DNSListenerProxy final
      22             :     : public nsIDNSListener
      23             :     , public nsIDNSListenerProxy
      24             : {
      25             : public:
      26           0 :   DNSListenerProxy(nsIDNSListener* aListener, nsIEventTarget* aTargetThread)
      27             :     // Sometimes aListener is a main-thread only object like XPCWrappedJS, and
      28             :     // sometimes it's a threadsafe object like nsSOCKSSocketInfo. Use a main-
      29             :     // thread pointer holder, but disable strict enforcement of thread invariants.
      30             :     // The AddRef implementation of XPCWrappedJS will assert if we go wrong here.
      31           0 :     : mListener(new nsMainThreadPtrHolder<nsIDNSListener>(
      32           0 :         "DNSListenerProxy::mListener", aListener, false))
      33           0 :     , mTargetThread(aTargetThread)
      34           0 :   { }
      35             : 
      36             :   NS_DECL_THREADSAFE_ISUPPORTS
      37             :   NS_DECL_NSIDNSLISTENER
      38             :   NS_DECL_NSIDNSLISTENERPROXY
      39             : 
      40           0 :   class OnLookupCompleteRunnable : public Runnable
      41             :   {
      42             :   public:
      43           0 :     OnLookupCompleteRunnable(const nsMainThreadPtrHandle<nsIDNSListener>& aListener,
      44             :                              nsICancelable* aRequest,
      45             :                              nsIDNSRecord* aRecord,
      46             :                              nsresult aStatus)
      47           0 :       : Runnable("DNSListenerProxy::OnLookupCompleteRunnable")
      48             :       , mListener(aListener)
      49             :       , mRequest(aRequest)
      50             :       , mRecord(aRecord)
      51           0 :       , mStatus(aStatus)
      52           0 :     { }
      53             : 
      54             :     NS_DECL_NSIRUNNABLE
      55             : 
      56             :   private:
      57             :     nsMainThreadPtrHandle<nsIDNSListener> mListener;
      58             :     nsCOMPtr<nsICancelable> mRequest;
      59             :     nsCOMPtr<nsIDNSRecord> mRecord;
      60             :     nsresult mStatus;
      61             :   };
      62             : 
      63             : private:
      64           0 :   ~DNSListenerProxy() {}
      65             : 
      66             :   nsMainThreadPtrHandle<nsIDNSListener> mListener;
      67             :   nsCOMPtr<nsIEventTarget> mTargetThread;
      68             : };
      69             : 
      70             : 
      71             : } // namespace net
      72             : } // namespace mozilla
      73             : 
      74             : #endif // DNSListenerProxy_h__

Generated by: LCOV version 1.13