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

Side by Side Diff: base/location.cc

Issue 8313013: Support JSON encoding of data for about:tracking information (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // MSDN says to #include <intrin.h>, but that breaks the VS2005 build. 8 // MSDN says to #include <intrin.h>, but that breaks the VS2005 build.
9 extern "C" { 9 extern "C" {
10 void* _ReturnAddress(); 10 void* _ReturnAddress();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 output->append("&gt;"); 64 output->append("&gt;");
65 break; 65 break;
66 66
67 default: 67 default:
68 output->push_back(*p); 68 output->push_back(*p);
69 break; 69 break;
70 } 70 }
71 } 71 }
72 } 72 }
73 73
74 base::DictionaryValue* Location::ToValue() const {
75 base::DictionaryValue* dictionary = new base::DictionaryValue;
76 dictionary->Set("file_name", base::Value::CreateStringValue(file_name_));
77 // Note: This function name is not escaped, and templates have less than
78 // characters, which means this is not suitable for display as HTML unless
79 // properly escaped.
80 dictionary->Set("function_name",
81 base::Value::CreateStringValue(function_name_));
82 dictionary->Set("line_number", base::Value::CreateIntegerValue(line_number_));
83 return dictionary;
84 }
85
74 #if defined(COMPILER_MSVC) 86 #if defined(COMPILER_MSVC)
75 __declspec(noinline) 87 __declspec(noinline)
76 #endif 88 #endif
77 BASE_EXPORT const void* GetProgramCounter() { 89 BASE_EXPORT const void* GetProgramCounter() {
78 #if defined(COMPILER_MSVC) 90 #if defined(COMPILER_MSVC)
79 return _ReturnAddress(); 91 return _ReturnAddress();
80 #elif defined(COMPILER_GCC) 92 #elif defined(COMPILER_GCC)
81 return __builtin_extract_return_addr(__builtin_return_address(0)); 93 return __builtin_extract_return_addr(__builtin_return_address(0));
82 #endif // COMPILER_GCC 94 #endif // COMPILER_GCC
83 95
84 return NULL; 96 return NULL;
85 } 97 }
86 98
87 } // namespace tracked_objects 99 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « base/location.h ('k') | base/message_loop.cc » ('j') | base/tracked_objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698