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

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: Created 4 years, 7 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
Index: webrtc/base/location.h
diff --git a/webrtc/base/location.h b/webrtc/base/location.h
new file mode 100644
index 0000000000000000000000000000000000000000..457555862e06a49fd629bef07f909a0596a6f6e9
--- /dev/null
+++ b/webrtc/base/location.h
@@ -0,0 +1,52 @@
+/*
+ * 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>
+
+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.
+ Location(const char* function_name, const char* file_name, int line_number);
+ Location();
+ Location(const Location& other);
+ Location& operator=(const Location& other);
+
+ const char* function_name() const { return function_name_; }
+ const char* file_name() const { return file_name_; }
+ int line_number() const { return line_number_; }
+
+ std::string ToString() const;
+
+ private:
+ const char* function_name_;
+ const char* file_name_;
+ int line_number_;
+};
+
+// Define a macro to record the current source location.
+#define FROM_HERE FROM_HERE_WITH_EXPLICIT_FUNCTION(__FUNCTION__)
tommi 2016/05/31 19:56:27 Sorry I didn't think of this before, but I think w
Taylor Brandstetter 2016/06/02 22:38:41 Definitely agree; done.
+
+#define FROM_HERE_WITH_EXPLICIT_FUNCTION(function_name) \
tommi 2016/05/31 19:56:27 and this one as well I guess. You could also shor
Taylor Brandstetter 2016/06/02 22:38:41 Done.
+ ::rtc::Location(function_name, __FILE__, __LINE__)
+
+} // namespace rtc
+
+#endif // WEBRTC_BASE_LOCATION_H_
« no previous file with comments | « webrtc/base/fakenetwork.h ('k') | webrtc/base/location.cc » ('j') | webrtc/base/location.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698