webrtc_m130/webrtc/base/location.h
kjellander ed754e71ae Enable GN check for webrtc/base
It's not possible to enable it for the rtc_base_approved
target but since a larger refactoring is ongoing for webrtc/base
this CL doesn't attempt to fix that.

Changes made:
* Move webrtc/system_wrappers/include/stringize_macros.h into
  webrtc/base:rtc_base_approved_unittests (and corresponding
  unit test to rtc_base_approved_unittests).
* Move md5digest.* from rtc_base_approved to rtc_base_test_utils target.
* Move webrtc/system_wrappers/include/stringize_macros.h (+test) into
  webrtc/base.
* Remove unused use include of webrtc/base/fileutils.h in
  webrtc/base/pathutils.cc

BUG=webrtc:6828, webrtc:3806, webrtc:7480
NOTRY=True

Review-Url: https://codereview.webrtc.org/2717083002
Cr-Commit-Position: refs/heads/master@{#17766}
2017-04-19 15:37:36 +00:00

58 lines
1.9 KiB
C++

/*
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_BASE_LOCATION_H_
#define WEBRTC_BASE_LOCATION_H_
#include <string>
#include "webrtc/base/stringize_macros.h"
namespace rtc {
// Location provides basic info where of an object was constructed, or was
// significantly brought to life.
// This is a stripped down version of:
// https://code.google.com/p/chromium/codesearch#chromium/src/base/location.h
class Location {
public:
// Constructor should be called with a long-lived char*, such as __FILE__.
// It assumes the provided value will persist as a global constant, and it
// will not make a copy of it.
//
// TODO(deadbeef): Tracing is currently limited to 2 arguments, which is
// why the file name and line number are combined into one argument.
//
// Once TracingV2 is available, separate the file name and line number.
Location(const char* function_name, const char* file_and_line);
Location();
Location(const Location& other);
Location& operator=(const Location& other);
const char* function_name() const { return function_name_; }
const char* file_and_line() const { return file_and_line_; }
std::string ToString() const;
private:
const char* function_name_;
const char* file_and_line_;
};
// Define a macro to record the current source location.
#define RTC_FROM_HERE RTC_FROM_HERE_WITH_FUNCTION(__FUNCTION__)
#define RTC_FROM_HERE_WITH_FUNCTION(function_name) \
::rtc::Location(function_name, __FILE__ ":" STRINGIZE(__LINE__))
} // namespace rtc
#endif // WEBRTC_BASE_LOCATION_H_