Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: webrtc/base/location.h

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing one more place where RTC_FROM_HERE wasn't used. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/fakenetwork.h ('k') | webrtc/base/location.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/location.h
diff --git a/webrtc/base/location.h b/webrtc/base/location.h
new file mode 100644
index 0000000000000000000000000000000000000000..a541bbef514763a461dab8e84974555c182c9b00
--- /dev/null
+++ b/webrtc/base/location.h
@@ -0,0 +1,57 @@
+/*
+ * 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/system_wrappers/include/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_
« no previous file with comments | « webrtc/base/fakenetwork.h ('k') | webrtc/base/location.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698