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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // Write functions assume that mutex_ is acquired by the caller. | 126 // Write functions assume that mutex_ is acquired by the caller. |
127 static WritePtr Write; | 127 static WritePtr Write; |
128 | 128 |
129 // Implementation of writing to a log file. | 129 // Implementation of writing to a log file. |
130 static int WriteToFile(const char* msg, int length) { | 130 static int WriteToFile(const char* msg, int length) { |
131 ASSERT(output_handle_ != NULL); | 131 ASSERT(output_handle_ != NULL); |
132 size_t rv = fwrite(msg, 1, length, output_handle_); | 132 size_t rv = fwrite(msg, 1, length, output_handle_); |
133 ASSERT(static_cast<size_t>(length) == rv); | 133 ASSERT(static_cast<size_t>(length) == rv); |
134 USE(rv); | 134 USE(rv); |
| 135 fflush(output_handle_); |
135 return length; | 136 return length; |
136 } | 137 } |
137 | 138 |
138 // Implementation of writing to a memory buffer. | 139 // Implementation of writing to a memory buffer. |
139 static int WriteToMemory(const char* msg, int length) { | 140 static int WriteToMemory(const char* msg, int length) { |
140 ASSERT(output_buffer_ != NULL); | 141 ASSERT(output_buffer_ != NULL); |
141 return output_buffer_->Write(msg, length); | 142 return output_buffer_->Write(msg, length); |
142 } | 143 } |
143 | 144 |
144 // Whether logging is stopped (e.g. due to insufficient resources). | 145 // Whether logging is stopped (e.g. due to insufficient resources). |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 281 |
281 ScopedLock sl; | 282 ScopedLock sl; |
282 int pos_; | 283 int pos_; |
283 }; | 284 }; |
284 | 285 |
285 #endif // ENABLE_LOGGING_AND_PROFILING | 286 #endif // ENABLE_LOGGING_AND_PROFILING |
286 | 287 |
287 } } // namespace v8::internal | 288 } } // namespace v8::internal |
288 | 289 |
289 #endif // V8_LOG_UTILS_H_ | 290 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |