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

          Line data    Source code
       1             : /*
       2             :  *  Copyright 2004 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             : #include <signal.h>
      12             : #include <stdlib.h>
      13             : #include <stdio.h>
      14             : #include <string.h>
      15             : 
      16             : #ifdef WEBRTC_WIN
      17             : #define WIN32_LEAN_AND_MEAN
      18             : #include <windows.h>
      19             : #endif  // WEBRTC_WIN 
      20             : 
      21             : #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
      22             : #include <CoreServices/CoreServices.h>
      23             : #endif  // WEBRTC_MAC && !defined(WEBRTC_IOS)
      24             : 
      25             : #include <algorithm>
      26             : #include "webrtc/base/common.h"
      27             : #include "webrtc/base/logging.h"
      28             : 
      29             : //////////////////////////////////////////////////////////////////////
      30             : // Assertions
      31             : //////////////////////////////////////////////////////////////////////
      32             : 
      33             : namespace rtc {
      34             : 
      35           0 : void Break() {
      36             : #ifdef WEBRTC_WIN
      37             :   ::DebugBreak();
      38             : #else  // !WEBRTC_WIN 
      39             :   // On POSIX systems, SIGTRAP signals debuggers to break without killing the
      40             :   // process. If a debugger isn't attached, the uncaught SIGTRAP will crash the
      41             :   // app.
      42           0 :   raise(SIGTRAP);
      43             : #endif
      44             :   // If a debugger wasn't attached, we will have crashed by this point. If a
      45             :   // debugger is attached, we'll continue from here.
      46           0 : }
      47             : 
      48             : static AssertLogger custom_assert_logger_ = NULL;
      49             : 
      50           0 : void SetCustomAssertLogger(AssertLogger logger) {
      51           0 :   custom_assert_logger_ = logger;
      52           0 : }
      53             : 
      54           0 : void LogAssert(const char* function, const char* file, int line,
      55             :                const char* expression) {
      56           0 :   if (custom_assert_logger_) {
      57           0 :     custom_assert_logger_(function, file, line, expression);
      58             :   } else {
      59           0 :     LOG(LS_ERROR) << file << "(" << line << ")" << ": ASSERT FAILED: "
      60           0 :                   << expression << " @ " << function;
      61             :   }
      62           0 : }
      63             : 
      64           0 : bool IsOdd(int n) {
      65           0 :   return (n & 0x1);
      66             : }
      67             : 
      68           0 : bool IsEven(int n) {
      69           0 :   return !IsOdd(n);
      70             : }
      71             : 
      72             : } // namespace rtc

Generated by: LCOV version 1.13