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

Side by Side Diff: base/location.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « base/location.h ('k') | base/mac/scoped_mach_port.h » ('j') | no next file with comments »
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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(COMPILER_MSVC) 7 #if defined(COMPILER_MSVC)
8 #include <intrin.h> 8 #include <intrin.h>
9 #endif 9 #endif
10 10
(...skipping 13 matching lines...) Expand all
24 program_counter_(program_counter) { 24 program_counter_(program_counter) {
25 } 25 }
26 26
27 Location::Location() 27 Location::Location()
28 : function_name_("Unknown"), 28 : function_name_("Unknown"),
29 file_name_("Unknown"), 29 file_name_("Unknown"),
30 line_number_(-1), 30 line_number_(-1),
31 program_counter_(NULL) { 31 program_counter_(NULL) {
32 } 32 }
33 33
34 Location::Location(const Location& other)
35 : function_name_(other.function_name_),
36 file_name_(other.file_name_),
37 line_number_(other.line_number_),
38 program_counter_(other.program_counter_) {
39 }
40
34 std::string Location::ToString() const { 41 std::string Location::ToString() const {
35 return std::string(function_name_) + "@" + file_name_ + ":" + 42 return std::string(function_name_) + "@" + file_name_ + ":" +
36 base::IntToString(line_number_); 43 base::IntToString(line_number_);
37 } 44 }
38 45
39 void Location::Write(bool display_filename, bool display_function_name, 46 void Location::Write(bool display_filename, bool display_function_name,
40 std::string* output) const { 47 std::string* output) const {
41 base::StringAppendF(output, "%s[%d] ", 48 base::StringAppendF(output, "%s[%d] ",
42 display_filename ? file_name_ : "line", 49 display_filename ? file_name_ : "line",
43 line_number_); 50 line_number_);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #if defined(COMPILER_MSVC) 97 #if defined(COMPILER_MSVC)
91 return _ReturnAddress(); 98 return _ReturnAddress();
92 #elif defined(COMPILER_GCC) && !defined(OS_NACL) 99 #elif defined(COMPILER_GCC) && !defined(OS_NACL)
93 return __builtin_extract_return_addr(__builtin_return_address(0)); 100 return __builtin_extract_return_addr(__builtin_return_address(0));
94 #else 101 #else
95 return NULL; 102 return NULL;
96 #endif 103 #endif
97 } 104 }
98 105
99 } // namespace tracked_objects 106 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « base/location.h ('k') | base/mac/scoped_mach_port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698