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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void AppendDetailed(String* str, bool show_impl_info); | 78 void AppendDetailed(String* str, bool show_impl_info); |
79 | 79 |
80 // Append a portion of a string. | 80 // Append a portion of a string. |
81 void AppendStringPart(const char* str, int len); | 81 void AppendStringPart(const char* str, int len); |
82 | 82 |
83 // Write the log message to the log file currently opened. | 83 // Write the log message to the log file currently opened. |
84 void WriteToLogFile(); | 84 void WriteToLogFile(); |
85 | 85 |
86 private: | 86 private: |
87 Log* log_; | 87 Log* log_; |
88 LockGuard<Mutex> lock_guard_; | 88 base::LockGuard<base::Mutex> lock_guard_; |
89 int pos_; | 89 int pos_; |
90 }; | 90 }; |
91 | 91 |
92 private: | 92 private: |
93 explicit Log(Logger* logger); | 93 explicit Log(Logger* logger); |
94 | 94 |
95 // Opens stdout for logging. | 95 // Opens stdout for logging. |
96 void OpenStdout(); | 96 void OpenStdout(); |
97 | 97 |
98 // Opens file for logging. | 98 // Opens file for logging. |
(...skipping 14 matching lines...) Expand all Loading... |
113 | 113 |
114 // Whether logging is stopped (e.g. due to insufficient resources). | 114 // Whether logging is stopped (e.g. due to insufficient resources). |
115 bool is_stopped_; | 115 bool is_stopped_; |
116 | 116 |
117 // When logging is active output_handle_ is used to store a pointer to log | 117 // When logging is active output_handle_ is used to store a pointer to log |
118 // destination. mutex_ should be acquired before using output_handle_. | 118 // destination. mutex_ should be acquired before using output_handle_. |
119 FILE* output_handle_; | 119 FILE* output_handle_; |
120 | 120 |
121 // mutex_ is a Mutex used for enforcing exclusive | 121 // mutex_ is a Mutex used for enforcing exclusive |
122 // access to the formatting buffer and the log file or log memory buffer. | 122 // access to the formatting buffer and the log file or log memory buffer. |
123 Mutex mutex_; | 123 base::Mutex mutex_; |
124 | 124 |
125 // Buffer used for formatting log messages. This is a singleton buffer and | 125 // Buffer used for formatting log messages. This is a singleton buffer and |
126 // mutex_ should be acquired before using it. | 126 // mutex_ should be acquired before using it. |
127 char* message_buffer_; | 127 char* message_buffer_; |
128 | 128 |
129 Logger* logger_; | 129 Logger* logger_; |
130 | 130 |
131 friend class Logger; | 131 friend class Logger; |
132 }; | 132 }; |
133 | 133 |
134 | 134 |
135 } } // namespace v8::internal | 135 } } // namespace v8::internal |
136 | 136 |
137 #endif // V8_LOG_UTILS_H_ | 137 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |