| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // Initialization function called from Open... functions. | 123 // Initialization function called from Open... functions. |
| 124 static void Init(); | 124 static void Init(); |
| 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 int rv = fwrite(msg, 1, length, output_handle_); | 132 size_t rv = fwrite(msg, 1, length, output_handle_); |
| 133 ASSERT(length == rv); | 133 ASSERT(static_cast<size_t>(length) == rv); |
| 134 return rv; | 134 USE(rv); |
| 135 return length; |
| 135 } | 136 } |
| 136 | 137 |
| 137 // Implementation of writing to a memory buffer. | 138 // Implementation of writing to a memory buffer. |
| 138 static int WriteToMemory(const char* msg, int length) { | 139 static int WriteToMemory(const char* msg, int length) { |
| 139 ASSERT(output_buffer_ != NULL); | 140 ASSERT(output_buffer_ != NULL); |
| 140 return output_buffer_->Write(msg, length); | 141 return output_buffer_->Write(msg, length); |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Whether logging is stopped (e.g. due to insufficient resources). | 144 // Whether logging is stopped (e.g. due to insufficient resources). |
| 144 static bool is_stopped_; | 145 static bool is_stopped_; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 283 |
| 283 ScopedLock sl; | 284 ScopedLock sl; |
| 284 int pos_; | 285 int pos_; |
| 285 }; | 286 }; |
| 286 | 287 |
| 287 #endif // ENABLE_LOGGING_AND_PROFILING | 288 #endif // ENABLE_LOGGING_AND_PROFILING |
| 288 | 289 |
| 289 } } // namespace v8::internal | 290 } } // namespace v8::internal |
| 290 | 291 |
| 291 #endif // V8_LOG_UTILS_H_ | 292 #endif // V8_LOG_UTILS_H_ |
| OLD | NEW |