LCOV - code coverage report
Current view: top level - accessible/xpcom - xpcAccessibilityService.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 9 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #ifndef mozilla_a11y_xpcAccessibilityService_h_
       6             : #define mozilla_a11y_xpcAccessibilityService_h_
       7             : 
       8             : #include "nsIAccessibilityService.h"
       9             : 
      10             : class xpcAccessibilityService : public nsIAccessibleRetrieval
      11             : {
      12             : 
      13             : public:
      14             :   NS_DECL_ISUPPORTS
      15             :   NS_DECL_NSIACCESSIBILITYSERVICE
      16             :   NS_DECL_NSIACCESSIBLERETRIEVAL
      17             : 
      18             :   /**
      19             :    * Return true if xpc accessibility service is in use.
      20             :    */
      21           0 :   static bool IsInUse() {
      22             :     // When ref count goes down to 1 (held internally as a static reference),
      23             :     // it means that there are no more external references and thus it is not in
      24             :     // use.
      25           0 :     return gXPCAccessibilityService ? gXPCAccessibilityService->mRefCnt > 1 : false;
      26             :   }
      27             : 
      28             : protected:
      29           0 :   virtual ~xpcAccessibilityService() {
      30           0 :     if (mShutdownTimer) {
      31           0 :       mShutdownTimer->Cancel();
      32           0 :       mShutdownTimer = nullptr;
      33             :     }
      34           0 :     gXPCAccessibilityService = nullptr;
      35           0 :   }
      36             : 
      37             : private:
      38             :   // xpcAccessibilityService creation is controlled by friend
      39             :   // NS_GetAccessibilityService, keep constructor private.
      40           0 :   xpcAccessibilityService() { };
      41             : 
      42             :   nsCOMPtr<nsITimer> mShutdownTimer;
      43             : 
      44             :   /**
      45             :    * Reference for xpc accessibility service instance.
      46             :    */
      47             :   static xpcAccessibilityService* gXPCAccessibilityService;
      48             : 
      49             :   /**
      50             :    * Used to shutdown nsAccessibilityService if xpcom accessible service is not
      51             :    * in use any more.
      52             :    */
      53             :   static void ShutdownCallback(nsITimer* aTimer, void* aClosure);
      54             : 
      55             :   friend nsresult NS_GetAccessibilityService(nsIAccessibilityService** aResult);
      56             : };
      57             : 
      58             : // for component registration
      59             : // {3b265b69-f813-48ff-880d-d88d101af404}
      60             : #define NS_ACCESSIBILITY_SERVICE_CID \
      61             : { 0x3b265b69, 0xf813, 0x48ff, { 0x88, 0x0d, 0xd8, 0x8d, 0x10, 0x1a, 0xf4, 0x04 } }
      62             : 
      63             : extern nsresult
      64             : NS_GetAccessibilityService(nsIAccessibilityService** aResult);
      65             : 
      66             : #endif

Generated by: LCOV version 1.13