LCOV - code coverage report
Current view: top level - layout/style - URLExtraData.h (source / functions) Hit Total Coverage
Test: output.info Lines: 14 17 82.4 %
Date: 2017-07-14 16:53:18 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 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             : /* thread-safe container of information for resolving url values */
       8             : 
       9             : #ifndef mozilla_URLExtraData_h
      10             : #define mozilla_URLExtraData_h
      11             : 
      12             : #include "mozilla/Move.h"
      13             : #include "mozilla/StaticPtr.h"
      14             : 
      15             : #include "nsCOMPtr.h"
      16             : #include "nsIPrincipal.h"
      17             : #include "nsIURI.h"
      18             : 
      19             : namespace mozilla {
      20             : 
      21             : struct URLExtraData
      22             : {
      23         690 :   URLExtraData(already_AddRefed<nsIURI> aBaseURI,
      24             :                already_AddRefed<nsIURI> aReferrer,
      25             :                already_AddRefed<nsIPrincipal> aPrincipal)
      26        1380 :     : mBaseURI(Move(aBaseURI))
      27         690 :     , mReferrer(Move(aReferrer))
      28        2070 :     , mPrincipal(Move(aPrincipal))
      29             :   {
      30         690 :     MOZ_ASSERT(mBaseURI);
      31         690 :   }
      32             : 
      33         667 :   URLExtraData(nsIURI* aBaseURI, nsIURI* aReferrer, nsIPrincipal* aPrincipal)
      34        2001 :     : URLExtraData(do_AddRef(aBaseURI),
      35        1334 :                    do_AddRef(aReferrer),
      36        2001 :                    do_AddRef(aPrincipal)) {}
      37             : 
      38         774 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLExtraData)
      39             : 
      40         183 :   nsIURI* BaseURI() const { return mBaseURI; }
      41          40 :   nsIURI* GetReferrer() const { return mReferrer; }
      42        1124 :   nsIPrincipal* GetPrincipal() const { return mPrincipal; }
      43             : 
      44           0 :   static URLExtraData* Dummy() {
      45           0 :     MOZ_ASSERT(sDummy);
      46           0 :     return sDummy;
      47             :   }
      48             :   static void InitDummy();
      49             :   static void ReleaseDummy();
      50             : 
      51             : private:
      52             :   ~URLExtraData();
      53             : 
      54             :   nsCOMPtr<nsIURI> mBaseURI;
      55             :   nsCOMPtr<nsIURI> mReferrer;
      56             :   nsCOMPtr<nsIPrincipal> mPrincipal;
      57             : 
      58             :   static StaticRefPtr<URLExtraData> sDummy;
      59             : };
      60             : 
      61             : } // namespace mozilla
      62             : 
      63             : #endif // mozilla_URLExtraData_h

Generated by: LCOV version 1.13