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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void AppendDetailed(String* str, bool show_impl_info); | 100 void AppendDetailed(String* str, bool show_impl_info); |
101 | 101 |
102 // Append a portion of a string. | 102 // Append a portion of a string. |
103 void AppendStringPart(const char* str, int len); | 103 void AppendStringPart(const char* str, int len); |
104 | 104 |
105 // Write the log message to the log file currently opened. | 105 // Write the log message to the log file currently opened. |
106 void WriteToLogFile(); | 106 void WriteToLogFile(); |
107 | 107 |
108 private: | 108 private: |
109 Log* log_; | 109 Log* log_; |
110 ScopedLock sl; | 110 LockGuard<Mutex> lock_guard_; |
111 int pos_; | 111 int pos_; |
112 }; | 112 }; |
113 | 113 |
114 private: | 114 private: |
115 explicit Log(Logger* logger); | 115 explicit Log(Logger* logger); |
116 | 116 |
117 // Opens stdout for logging. | 117 // Opens stdout for logging. |
118 void OpenStdout(); | 118 void OpenStdout(); |
119 | 119 |
120 // Opens file for logging. | 120 // Opens file for logging. |
(...skipping 14 matching lines...) Expand all Loading... |
135 | 135 |
136 // Whether logging is stopped (e.g. due to insufficient resources). | 136 // Whether logging is stopped (e.g. due to insufficient resources). |
137 bool is_stopped_; | 137 bool is_stopped_; |
138 | 138 |
139 // When logging is active output_handle_ is used to store a pointer to log | 139 // When logging is active output_handle_ is used to store a pointer to log |
140 // destination. mutex_ should be acquired before using output_handle_. | 140 // destination. mutex_ should be acquired before using output_handle_. |
141 FILE* output_handle_; | 141 FILE* output_handle_; |
142 | 142 |
143 // mutex_ is a Mutex used for enforcing exclusive | 143 // mutex_ is a Mutex used for enforcing exclusive |
144 // access to the formatting buffer and the log file or log memory buffer. | 144 // access to the formatting buffer and the log file or log memory buffer. |
145 Mutex* mutex_; | 145 Mutex mutex_; |
146 | 146 |
147 // Buffer used for formatting log messages. This is a singleton buffer and | 147 // Buffer used for formatting log messages. This is a singleton buffer and |
148 // mutex_ should be acquired before using it. | 148 // mutex_ should be acquired before using it. |
149 char* message_buffer_; | 149 char* message_buffer_; |
150 | 150 |
151 Logger* logger_; | 151 Logger* logger_; |
152 | 152 |
153 friend class Logger; | 153 friend class Logger; |
154 }; | 154 }; |
155 | 155 |
156 | 156 |
157 } } // namespace v8::internal | 157 } } // namespace v8::internal |
158 | 158 |
159 #endif // V8_LOG_UTILS_H_ | 159 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |