OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1760 | 1760 |
1761 | 1761 |
1762 static void AddIsolateIdIfNeeded(std::ostream& os, // NOLINT | 1762 static void AddIsolateIdIfNeeded(std::ostream& os, // NOLINT |
1763 Isolate* isolate) { | 1763 Isolate* isolate) { |
1764 if (FLAG_logfile_per_isolate) os << "isolate-" << isolate << "-"; | 1764 if (FLAG_logfile_per_isolate) os << "isolate-" << isolate << "-"; |
1765 } | 1765 } |
1766 | 1766 |
1767 | 1767 |
1768 static void PrepareLogFileName(std::ostream& os, // NOLINT | 1768 static void PrepareLogFileName(std::ostream& os, // NOLINT |
1769 Isolate* isolate, const char* file_name) { | 1769 Isolate* isolate, const char* file_name) { |
1770 AddIsolateIdIfNeeded(os, isolate); | 1770 int slash_count = 0; |
1771 for (const char* p = file_name; *p; p++) { | 1771 for (const char* p = file_name; *p; p++) { |
1772 if (*p == '%') { | 1772 if (base::OS::isDirectorySeparator(*p)) |
1773 slash_count++; | |
Yang
2015/03/03 08:36:57
no line break after if.
sejunho
2015/03/03 10:14:50
Done.
| |
1774 } | |
1775 | |
1776 for (const char* p = file_name; *p; p++) { | |
1777 if (slash_count == 0) { | |
1778 AddIsolateIdIfNeeded(os, isolate); | |
1779 slash_count--; | |
1780 } | |
1781 | |
1782 if (base::OS::isDirectorySeparator(*p)) { | |
1783 slash_count--; | |
1784 os << *p; | |
1785 } else if (*p == '%') { | |
Yang
2015/03/03 08:36:57
How about
if (*p == '%') {
...
} else {
if (
sejunho
2015/03/03 10:14:50
OK.
| |
1773 p++; | 1786 p++; |
1774 switch (*p) { | 1787 switch (*p) { |
1775 case '\0': | 1788 case '\0': |
1776 // If there's a % at the end of the string we back up | 1789 // If there's a % at the end of the string we back up |
1777 // one character so we can escape the loop properly. | 1790 // one character so we can escape the loop properly. |
1778 p--; | 1791 p--; |
1779 break; | 1792 break; |
1780 case 'p': | 1793 case 'p': |
1781 os << base::OS::GetCurrentProcessId(); | 1794 os << base::OS::GetCurrentProcessId(); |
1782 break; | 1795 break; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1908 if (jit_logger_) { | 1921 if (jit_logger_) { |
1909 removeCodeEventListener(jit_logger_); | 1922 removeCodeEventListener(jit_logger_); |
1910 delete jit_logger_; | 1923 delete jit_logger_; |
1911 jit_logger_ = NULL; | 1924 jit_logger_ = NULL; |
1912 } | 1925 } |
1913 | 1926 |
1914 return log_->Close(); | 1927 return log_->Close(); |
1915 } | 1928 } |
1916 | 1929 |
1917 } } // namespace v8::internal | 1930 } } // namespace v8::internal |
OLD | NEW |