LCOV - code coverage report
Current view: top level - gfx/layers/ipc - CompositorThread.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 5 60.0 %
Date: 2017-07-14 16:53:18 Functions: 2 5 40.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 sts=2 ts=8 et tw=99 : */
       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             : #ifndef mozilla_layers_CompositorThread_h
       7             : #define mozilla_layers_CompositorThread_h
       8             : 
       9             : #include "base/basictypes.h"            // for DISALLOW_EVIL_CONSTRUCTORS
      10             : #include "base/platform_thread.h"       // for PlatformThreadId
      11             : #include "base/thread.h"                // for Thread
      12             : #include "base/message_loop.h"
      13             : #include "nsISupportsImpl.h"
      14             : #include "ThreadSafeRefcountingWithMainThreadDestruction.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace layers {
      18             : 
      19             : class CompositorThreadHolder final
      20             : {
      21           7 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorThreadHolder)
      22             : 
      23             : public:
      24             :   CompositorThreadHolder();
      25             : 
      26       21801 :   base::Thread* GetCompositorThread() const {
      27       21801 :     return mCompositorThread;
      28             :   }
      29             : 
      30             :   static CompositorThreadHolder* GetSingleton();
      31             : 
      32           0 :   static bool IsActive() {
      33           0 :     return !!GetSingleton();
      34             :   }
      35             : 
      36             :   /**
      37             :    * Creates the compositor thread and the global compositor map.
      38             :    */
      39             :   static void Start();
      40             : 
      41             :   /*
      42             :    * Waits for all [CrossProcess]CompositorBridgeParents to shutdown and
      43             :    * releases compositor-thread owned resources.
      44             :    */
      45             :   static void Shutdown();
      46             : 
      47             :   static MessageLoop* Loop();
      48             : 
      49             :   // Returns true if the calling thread is the compositor thread.
      50             :   static bool IsInCompositorThread();
      51             : 
      52             : private:
      53             :   ~CompositorThreadHolder();
      54             : 
      55             :   base::Thread* const mCompositorThread;
      56             : 
      57             :   static base::Thread* CreateCompositorThread();
      58             :   static void DestroyCompositorThread(base::Thread* aCompositorThread);
      59             : 
      60             :   friend class CompositorBridgeParent;
      61             : };
      62             : 
      63             : base::Thread* CompositorThread();
      64             : 
      65             : } // namespace layers
      66             : } // namespace mozilla
      67             : 
      68             : #endif // mozilla_layers_CompositorThread_h

Generated by: LCOV version 1.13