| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium 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 "platform/inspector_protocol/Values.h" | 5 #include "platform/inspector_protocol/Values.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
| 8 #include "platform/inspector_protocol/String16.h" | 8 #include "platform/inspector_protocol/String16.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 case '\r': dst->append("\\r"); break; | 28 case '\r': dst->append("\\r"); break; |
| 29 case '\t': dst->append("\\t"); break; | 29 case '\t': dst->append("\\t"); break; |
| 30 case '\\': dst->append("\\\\"); break; | 30 case '\\': dst->append("\\\\"); break; |
| 31 case '"': dst->append("\\\""); break; | 31 case '"': dst->append("\\\""); break; |
| 32 default: | 32 default: |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 const LChar hexDigits[17] = "0123456789ABCDEF"; | 38 const char hexDigits[17] = "0123456789ABCDEF"; |
| 39 | 39 |
| 40 void appendUnsignedAsHex(UChar number, String16Builder* dst) | 40 void appendUnsignedAsHex(UChar number, String16Builder* dst) |
| 41 { | 41 { |
| 42 dst->append("\\u"); | 42 dst->append("\\u"); |
| 43 for (size_t i = 0; i < 4; ++i) { | 43 for (size_t i = 0; i < 4; ++i) { |
| 44 dst->append(hexDigits[(number & 0xF000) >> 12]); | 44 UChar c = hexDigits[(number & 0xF000) >> 12]; |
| 45 dst->append(c); |
| 45 number <<= 4; | 46 number <<= 4; |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 void escapeStringForJSON(const String16& str, String16Builder* dst) | 50 void escapeStringForJSON(const String16& str, String16Builder* dst) |
| 50 { | 51 { |
| 51 for (unsigned i = 0; i < str.length(); ++i) { | 52 for (unsigned i = 0; i < str.length(); ++i) { |
| 52 UChar c = str[i]; | 53 UChar c = str[i]; |
| 53 if (!escapeChar(c, dst)) { | 54 if (!escapeChar(c, dst)) { |
| 54 if (c < 32 || c > 126 || c == '<' || c == '>') { | 55 if (c < 32 || c > 126 || c == '<' || c == '>') { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 402 } |
| 402 | 403 |
| 403 protocol::Value* ListValue::at(size_t index) | 404 protocol::Value* ListValue::at(size_t index) |
| 404 { | 405 { |
| 405 DCHECK_LT(index, m_data.size()); | 406 DCHECK_LT(index, m_data.size()); |
| 406 return m_data[index].get(); | 407 return m_data[index].get(); |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace protocol | 410 } // namespace protocol |
| 410 } // namespace blink | 411 } // namespace blink |
| OLD | NEW |