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

Side by Side Diff: base/location.h

Issue 18083015: Add queued_time_ms trace for events in message loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ConvertableToTraceFormat Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/location.cc » ('j') | base/location.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_LOCATION_H_ 5 #ifndef BASE_LOCATION_H_
6 #define BASE_LOCATION_H_ 6 #define BASE_LOCATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace base {
15 namespace debug {
16 class ConvertableToTraceFormat;
17 }
18 }
12 19
13 namespace tracked_objects { 20 namespace tracked_objects {
14 21
15 // Location provides basic info where of an object was constructed, or was 22 // Location provides basic info where of an object was constructed, or was
16 // significantly brought to life. 23 // significantly brought to life.
17 class BASE_EXPORT Location { 24 class BASE_EXPORT Location {
18 public: 25 public:
19 // Constructor should be called with a long-lived char*, such as __FILE__. 26 // Constructor should be called with a long-lived char*, such as __FILE__.
20 // It assumes the provided value will persist as a global constant, and it 27 // It assumes the provided value will persist as a global constant, and it
21 // will not make a copy of it. 28 // will not make a copy of it.
(...skipping 18 matching lines...) Expand all
40 return file_name_ < other.file_name_; 47 return file_name_ < other.file_name_;
41 return function_name_ < other.function_name_; 48 return function_name_ < other.function_name_;
42 } 49 }
43 50
44 const char* function_name() const { return function_name_; } 51 const char* function_name() const { return function_name_; }
45 const char* file_name() const { return file_name_; } 52 const char* file_name() const { return file_name_; }
46 int line_number() const { return line_number_; } 53 int line_number() const { return line_number_; }
47 const void* program_counter() const { return program_counter_; } 54 const void* program_counter() const { return program_counter_; }
48 55
49 std::string ToString() const; 56 std::string ToString() const;
57 scoped_ptr<base::debug::ConvertableToTraceFormat> ToTraceFormat() const;
50 58
51 // Translate the some of the state in this instance into a human readable 59 // Translate the some of the state in this instance into a human readable
52 // string with HTML characters in the function names escaped, and append that 60 // string with HTML characters in the function names escaped, and append that
53 // string to |output|. Inclusion of the file_name_ and function_name_ are 61 // string to |output|. Inclusion of the file_name_ and function_name_ are
54 // optional, and controlled by the boolean arguments. 62 // optional, and controlled by the boolean arguments.
55 void Write(bool display_filename, bool display_function_name, 63 void Write(bool display_filename, bool display_function_name,
56 std::string* output) const; 64 std::string* output) const;
57 65
58 // Write function_name_ in HTML with '<' and '>' properly encoded. 66 // Write function_name_ in HTML with '<' and '>' properly encoded.
59 void WriteFunctionName(std::string* output) const; 67 void WriteFunctionName(std::string* output) const;
(...skipping 25 matching lines...) Expand all
85 93
86 #define FROM_HERE_WITH_EXPLICIT_FUNCTION(function_name) \ 94 #define FROM_HERE_WITH_EXPLICIT_FUNCTION(function_name) \
87 ::tracked_objects::Location(function_name, \ 95 ::tracked_objects::Location(function_name, \
88 __FILE__, \ 96 __FILE__, \
89 __LINE__, \ 97 __LINE__, \
90 ::tracked_objects::GetProgramCounter()) 98 ::tracked_objects::GetProgramCounter())
91 99
92 } // namespace tracked_objects 100 } // namespace tracked_objects
93 101
94 #endif // BASE_LOCATION_H_ 102 #endif // BASE_LOCATION_H_
OLDNEW
« no previous file with comments | « no previous file | base/location.cc » ('j') | base/location.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698