OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 output_buffer_ = new LogDynamicBuffer( | 156 output_buffer_ = new LogDynamicBuffer( |
157 kDynamicBufferBlockSize, kMaxDynamicBufferSize, | 157 kDynamicBufferBlockSize, kMaxDynamicBufferSize, |
158 kDynamicBufferSeal, strlen(kDynamicBufferSeal)); | 158 kDynamicBufferSeal, strlen(kDynamicBufferSeal)); |
159 Write = WriteToMemory; | 159 Write = WriteToMemory; |
160 Init(); | 160 Init(); |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 void Log::Close() { | 164 void Log::Close() { |
165 if (Write == WriteToFile) { | 165 if (Write == WriteToFile) { |
166 fclose(output_handle_); | 166 if(output_handle_ != NULL) fclose(output_handle_); |
167 output_handle_ = NULL; | 167 output_handle_ = NULL; |
168 } else if (Write == WriteToMemory) { | 168 } else if (Write == WriteToMemory) { |
169 delete output_buffer_; | 169 delete output_buffer_; |
170 output_buffer_ = NULL; | 170 output_buffer_ = NULL; |
171 } else { | 171 } else { |
172 ASSERT(Write == NULL); | 172 ASSERT(Write == NULL); |
173 } | 173 } |
174 Write = NULL; | 174 Write = NULL; |
175 | 175 |
176 DeleteArray(message_buffer_); | 176 DeleteArray(message_buffer_); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 494 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
495 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 495 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
496 prev_record->Truncate(unchanged_len + best.backref_size); | 496 prev_record->Truncate(unchanged_len + best.backref_size); |
497 } | 497 } |
498 return true; | 498 return true; |
499 } | 499 } |
500 | 500 |
501 #endif // ENABLE_LOGGING_AND_PROFILING | 501 #endif // ENABLE_LOGGING_AND_PROFILING |
502 | 502 |
503 } } // namespace v8::internal | 503 } } // namespace v8::internal |
OLD | NEW |