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

Side by Side Diff: base/tracked.cc

Issue 3012001: Move implementation from header to source. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: blank line Created 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "base/tracked.h" 5 #include "base/tracked.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/tracked_objects.h" 8 #include "base/tracked_objects.h"
9 9
10 using base::TimeTicks; 10 using base::TimeTicks;
11 11
12 namespace tracked_objects { 12 namespace tracked_objects {
13 13
14 //------------------------------------------------------------------------------ 14 //------------------------------------------------------------------------------
15
16 Location::Location(const char* function_name, const char* file_name,
17 int line_number)
18 : function_name_(function_name),
19 file_name_(file_name),
20 line_number_(line_number) {
21 }
22
23 Location::Location()
24 : function_name_("Unknown"),
25 file_name_("Unknown"),
26 line_number_(-1) {
27 }
28
29 bool Location::operator < (const Location& other) const {
30 if (line_number_ != other.line_number_)
31 return line_number_ < other.line_number_;
32 if (file_name_ != other.file_name_)
33 return file_name_ < other.file_name_;
34 return function_name_ < other.function_name_;
35 }
36
15 void Location::Write(bool display_filename, bool display_function_name, 37 void Location::Write(bool display_filename, bool display_function_name,
16 std::string* output) const { 38 std::string* output) const {
17 StringAppendF(output, "%s[%d] ", 39 StringAppendF(output, "%s[%d] ",
18 display_filename ? file_name_ : "line", 40 display_filename ? file_name_ : "line",
19 line_number_); 41 line_number_);
20 42
21 if (display_function_name) { 43 if (display_function_name) {
22 WriteFunctionName(output); 44 WriteFunctionName(output);
23 output->push_back(' '); 45 output->push_back(' ');
24 } 46 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 tracked_birth_time_ = TimeTicks::Now(); 108 tracked_birth_time_ = TimeTicks::Now();
87 } 109 }
88 110
89 bool Tracked::MissingBirthplace() const { 111 bool Tracked::MissingBirthplace() const {
90 return -1 == tracked_births_->location().line_number(); 112 return -1 == tracked_births_->location().line_number();
91 } 113 }
92 114
93 #endif // NDEBUG 115 #endif // NDEBUG
94 116
95 } // namespace tracked_objects 117 } // namespace tracked_objects
OLDNEW
« base/tracked.h ('K') | « base/tracked.h ('k') | base/values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698