LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/include - module.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_MODULES_INCLUDE_MODULE_H_
      12             : #define WEBRTC_MODULES_INCLUDE_MODULE_H_
      13             : 
      14             : #include "webrtc/typedefs.h"
      15             : 
      16             : namespace webrtc {
      17             : 
      18             : class ProcessThread;
      19             : 
      20           0 : class Module {
      21             :  public:
      22             :   // Returns the number of milliseconds until the module wants a worker
      23             :   // thread to call Process.
      24             :   // This method is called on the same worker thread as Process will
      25             :   // be called on.
      26             :   // TODO(tommi): Almost all implementations of this function, need to know
      27             :   // the current tick count.  Consider passing it as an argument.  It could
      28             :   // also improve the accuracy of when the next callback occurs since the
      29             :   // thread that calls Process() will also have it's tick count reference
      30             :   // which might not match with what the implementations use.
      31             :   virtual int64_t TimeUntilNextProcess() = 0;
      32             : 
      33             :   // Process any pending tasks such as timeouts.
      34             :   // Called on a worker thread.
      35             :   virtual void Process() = 0;
      36             : 
      37             :   // This method is called when the module is attached to a *running* process
      38             :   // thread or detached from one.  In the case of detaching, |process_thread|
      39             :   // will be nullptr.
      40             :   //
      41             :   // This method will be called in the following cases:
      42             :   //
      43             :   // * Non-null process_thread:
      44             :   //   * ProcessThread::RegisterModule() is called while the thread is running.
      45             :   //   * ProcessThread::Start() is called and RegisterModule has previously
      46             :   //     been called.  The thread will be started immediately after notifying
      47             :   //     all modules.
      48             :   //
      49             :   // * Null process_thread:
      50             :   //   * ProcessThread::DeRegisterModule() is called while the thread is
      51             :   //     running.
      52             :   //   * ProcessThread::Stop() was called and the thread has been stopped.
      53             :   //
      54             :   // NOTE: This method is not called from the worker thread itself, but from
      55             :   //       the thread that registers/deregisters the module or calls Start/Stop.
      56           0 :   virtual void ProcessThreadAttached(ProcessThread* process_thread) {}
      57             : 
      58             :  protected:
      59           0 :   virtual ~Module() {}
      60             : };
      61             : 
      62             : // Reference counted version of the Module interface.
      63           0 : class RefCountedModule : public Module {
      64             :  public:
      65             :   // Increase the reference count by one.
      66             :   // Returns the incremented reference count.
      67             :   virtual int32_t AddRef() const = 0;
      68             : 
      69             :   // Decrease the reference count by one.
      70             :   // Returns the decreased reference count.
      71             :   // Returns 0 if the last reference was just released.
      72             :   // When the reference count reaches 0 the object will self-destruct.
      73             :   virtual int32_t Release() const = 0;
      74             : 
      75             :  protected:
      76           0 :   ~RefCountedModule() override = default;
      77             : };
      78             : 
      79             : }  // namespace webrtc
      80             : 
      81             : #endif  // WEBRTC_MODULES_INCLUDE_MODULE_H_

Generated by: LCOV version 1.13