| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project 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 V8_LOG_UTILS_H_ | 5 #ifndef V8_LOG_UTILS_H_ |
| 6 #define V8_LOG_UTILS_H_ | 6 #define V8_LOG_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 9 | 11 |
| 10 namespace v8 { | 12 namespace v8 { |
| 11 namespace internal { | 13 namespace internal { |
| 12 | 14 |
| 13 class Logger; | 15 class Logger; |
| 14 | 16 |
| 15 // Functions and data for performing output of log messages. | 17 // Functions and data for performing output of log messages. |
| 16 class Log { | 18 class Log { |
| 17 public: | 19 public: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Appends an address. | 75 // Appends an address. |
| 74 void AppendAddress(Address addr); | 76 void AppendAddress(Address addr); |
| 75 | 77 |
| 76 void AppendSymbolName(Symbol* symbol); | 78 void AppendSymbolName(Symbol* symbol); |
| 77 | 79 |
| 78 void AppendDetailed(String* str, bool show_impl_info); | 80 void AppendDetailed(String* str, bool show_impl_info); |
| 79 | 81 |
| 80 // Append a portion of a string. | 82 // Append a portion of a string. |
| 81 void AppendStringPart(const char* str, int len); | 83 void AppendStringPart(const char* str, int len); |
| 82 | 84 |
| 85 // GetSubstring fills str with a string consisting |
| 86 // all that's been appendend starting from a call to |
| 87 // StartSubstring and till a call to EndSubstring |
| 88 void StartSubstring(); |
| 89 void EndSubstring(); |
| 90 void GetSubstring(std::string* str); |
| 91 |
| 83 // Write the log message to the log file currently opened. | 92 // Write the log message to the log file currently opened. |
| 84 void WriteToLogFile(); | 93 void WriteToLogFile(); |
| 85 | 94 |
| 86 private: | 95 private: |
| 87 Log* log_; | 96 Log* log_; |
| 88 base::LockGuard<base::Mutex> lock_guard_; | 97 base::LockGuard<base::Mutex> lock_guard_; |
| 89 int pos_; | 98 int pos_; |
| 99 int substr_start_pos_; |
| 100 int substr_end_pos_; |
| 90 }; | 101 }; |
| 91 | 102 |
| 92 private: | 103 private: |
| 93 explicit Log(Logger* logger); | 104 explicit Log(Logger* logger); |
| 94 | 105 |
| 95 // Opens stdout for logging. | 106 // Opens stdout for logging. |
| 96 void OpenStdout(); | 107 void OpenStdout(); |
| 97 | 108 |
| 98 // Opens file for logging. | 109 // Opens file for logging. |
| 99 void OpenFile(const char* name); | 110 void OpenFile(const char* name); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 128 | 139 |
| 129 Logger* logger_; | 140 Logger* logger_; |
| 130 | 141 |
| 131 friend class Logger; | 142 friend class Logger; |
| 132 }; | 143 }; |
| 133 | 144 |
| 134 | 145 |
| 135 } } // namespace v8::internal | 146 } } // namespace v8::internal |
| 136 | 147 |
| 137 #endif // V8_LOG_UTILS_H_ | 148 #endif // V8_LOG_UTILS_H_ |
| OLD | NEW |