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

Unified Diff: base/debug/trace_event_win.h

Issue 368133002: Fixes for re-enabling more MSVC level 4 warnings: base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build, attempt 2 Created 6 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 | « base/debug/trace_event_unittest.cc ('k') | base/debug/trace_event_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_win.h
diff --git a/base/debug/trace_event_win.h b/base/debug/trace_event_win.h
index 2a900bb4314f055b67a24bfea4bcdc766a569424..c85ca9217cff7ba096c6fc59af37322316dff6b3 100644
--- a/base/debug/trace_event_win.h
+++ b/base/debug/trace_event_win.h
@@ -23,6 +23,8 @@ namespace debug {
// for the macros above on Windows.
class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider {
public:
+ static const size_t kUseStrlen = static_cast<size_t>(-1);
+
// Start logging trace events.
// This is a noop in this implementation.
static bool StartTracing();
@@ -32,8 +34,8 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider {
// Allowing the use of std::string for name or extra is a convenience,
// whereas passing name or extra as a const char* avoids the construction
// of temporary std::string instances.
- // If -1 is passed for name_len or extra_len, the strlen of the string will
- // be used for length.
+ // If kUseStrlen is passed for name_len or extra_len, the strlen of the string
+ // will be used for length.
static void Trace(const char* name,
size_t name_len,
char type,
@@ -46,7 +48,7 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider {
char type,
const void* id,
const std::string& extra) {
- return Trace(name, -1, type, id, extra.c_str(), extra.length());
+ return Trace(name, kUseStrlen, type, id, extra.c_str(), extra.length());
}
// Allows passing extra as a const char* to avoid constructing temporary
@@ -55,7 +57,7 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider {
char type,
const void* id,
const char* extra) {
- return Trace(name, -1, type, id, extra, -1);
+ return Trace(name, kUseStrlen, type, id, extra, kUseStrlen);
}
// Retrieves the singleton.
@@ -70,8 +72,8 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider {
// Emit a trace of type |type| containing |name|, |id|, and |extra|.
// Note: |name| and |extra| must be NULL, or a zero-terminated string of
// length |name_len| or |extra_len| respectively.
- // Note: if name_len or extra_len are -1, the length of the corresponding
- // string will be used.
+ // Note: if name_len or extra_len are kUseStrlen, the length of the
+ // corresponding string will be used.
void TraceEvent(const char* name,
size_t name_len,
char type,
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | base/debug/trace_event_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698