LCOV - code coverage report
Current view: top level - hal - WindowIdentifier.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
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 sw=2 ts=8 et ft=cpp : */
       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 mozilla_hal_WindowIdentifier_h
       8             : #define mozilla_hal_WindowIdentifier_h
       9             : 
      10             : #include "mozilla/Types.h"
      11             : #include "nsCOMPtr.h"
      12             : #include "nsTArray.h"
      13             : 
      14             : class nsPIDOMWindowInner;
      15             : 
      16             : namespace mozilla {
      17             : namespace hal {
      18             : 
      19             : /**
      20             :  * This class serves two purposes.
      21             :  *
      22             :  * First, this class wraps a pointer to a window.
      23             :  *
      24             :  * Second, WindowIdentifier lets us uniquely identify a window across
      25             :  * processes.  A window exposes an ID which is unique only within its
      26             :  * process.  Thus to identify a window, we need to know the ID of the
      27             :  * process which contains it.  But the scope of a process's ID is its
      28             :  * parent; that is, two processes with different parents might have
      29             :  * the same ID.
      30             :  *
      31             :  * So to identify a window, we need its ID plus the IDs of all the
      32             :  * processes in the path from the window's process to the root
      33             :  * process.  We throw in the IDs of the intermediate windows (a
      34             :  * content window is contained in a window at each level of the
      35             :  * process tree) for good measures.
      36             :  *
      37             :  * You can access this list of IDs by calling AsArray().
      38             :  */
      39           0 : class WindowIdentifier
      40             : {
      41             : public:
      42             :   /**
      43             :    * Create an empty WindowIdentifier.  Calls to any of this object's
      44             :    * public methods will assert -- an empty WindowIdentifier may be
      45             :    * used only as a placeholder to code which promises not to touch
      46             :    * the object.
      47             :    */
      48             :   WindowIdentifier();
      49             : 
      50             :   /**
      51             :    * Copy constructor.
      52             :    */
      53             :   WindowIdentifier(const WindowIdentifier& other);
      54             : 
      55             :   /**
      56             :    * Wrap the given window in a WindowIdentifier.  These two
      57             :    * constructors automatically grab the window's ID and append it to
      58             :    * the array of IDs.
      59             :    *
      60             :    * Note that these constructors allow an implicit conversion to a
      61             :    * WindowIdentifier.
      62             :    */
      63             :   explicit WindowIdentifier(nsPIDOMWindowInner* window);
      64             : 
      65             :   /**
      66             :    * Create a new WindowIdentifier with the given id array and window.
      67             :    * This automatically grabs the window's ID and appends it to the
      68             :    * array.
      69             :    */
      70             :   WindowIdentifier(const InfallibleTArray<uint64_t>& id,
      71             :                    nsPIDOMWindowInner* window);
      72             : 
      73             :   /**
      74             :    * Get the list of window and process IDs we contain.
      75             :    */
      76             :   typedef InfallibleTArray<uint64_t> IDArrayType;
      77             :   const IDArrayType& AsArray() const;
      78             : 
      79             :   /**
      80             :    * Append the ID of the ContentChild singleton to our array of
      81             :    * window/process IDs.
      82             :    */
      83             :   void AppendProcessID();
      84             : 
      85             :   /**
      86             :    * Does this WindowIdentifier identify both a window and the process
      87             :    * containing that window?  If so, we say it has traveled through
      88             :    * IPC.
      89             :    */
      90             :   bool HasTraveledThroughIPC() const;
      91             : 
      92             :   /**
      93             :    * Get the window this object wraps.
      94             :    */
      95             :   nsPIDOMWindowInner* GetWindow() const;
      96             : 
      97             : private:
      98             :   /**
      99             :    * Get the ID of the window object we wrap.
     100             :    */
     101             :   uint64_t GetWindowID() const;
     102             : 
     103             :   AutoTArray<uint64_t, 3> mID;
     104             :   nsCOMPtr<nsPIDOMWindowInner> mWindow;
     105             :   bool mIsEmpty;
     106             : };
     107             : 
     108             : } // namespace hal
     109             : } // namespace mozilla
     110             : 
     111             : #endif // mozilla_hal_WindowIdentifier_h

Generated by: LCOV version 1.13