LCOV - code coverage report
Current view: top level - dom/base - DispatcherTrait.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.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 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             : #ifndef mozilla_dom_DispatcherTrait_h
       8             : #define mozilla_dom_DispatcherTrait_h
       9             : 
      10             : #include "mozilla/AlreadyAddRefed.h"
      11             : #include "mozilla/TaskCategory.h"
      12             : 
      13             : class nsIRunnable;
      14             : class nsISerialEventTarget;
      15             : 
      16             : namespace mozilla {
      17             : class AbstractThread;
      18             : namespace dom {
      19             : class TabGroup;
      20             : 
      21             : // This trait should be attached to classes like nsIGlobalObject and nsIDocument
      22             : // that have a DocGroup or TabGroup attached to them. The methods here should
      23             : // delegate to the DocGroup or TabGroup. We can't use the Dispatcher class
      24             : // directly because it inherits from nsISupports.
      25         354 : class DispatcherTrait {
      26             : public:
      27             :   // This method may or may not be safe off of the main thread. For nsIDocument
      28             :   // it is safe. For nsIGlobalWindow it is not safe.
      29             :   virtual nsresult Dispatch(const char* aName,
      30             :                             TaskCategory aCategory,
      31             :                             already_AddRefed<nsIRunnable>&& aRunnable);
      32             : 
      33             :   // This method may or may not be safe off of the main thread. For nsIDocument
      34             :   // it is safe. For nsIGlobalWindow it is not safe. The nsISerialEventTarget can
      35             :   // always be used off the main thread.
      36             :   virtual nsISerialEventTarget* EventTargetFor(TaskCategory aCategory) const;
      37             : 
      38             :   // Must be called on the main thread. The AbstractThread can always be used
      39             :   // off the main thread.
      40             :   virtual AbstractThread* AbstractMainThreadFor(TaskCategory aCategory);
      41             : };
      42             : 
      43             : } // namespace dom
      44             : } // namespace mozilla
      45             : 
      46             : #endif // mozilla_dom_DispatcherTrait_h

Generated by: LCOV version 1.13