| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 212 } |
| 213 | 213 |
| 214 // ErrorContext holds a stack of string literals which describe what was | 214 // ErrorContext holds a stack of string literals which describe what was |
| 215 // happening at the time the error occurred. This is helpful because | 215 // happening at the time the error occurred. This is helpful because |
| 216 // parsing of the algorithm dictionary can be recursive and it is difficult to | 216 // parsing of the algorithm dictionary can be recursive and it is difficult to |
| 217 // tell what went wrong from a failure alone. | 217 // tell what went wrong from a failure alone. |
| 218 class ErrorContext { | 218 class ErrorContext { |
| 219 public: | 219 public: |
| 220 void add(const char* message) { m_messages.append(message); } | 220 void add(const char* message) { m_messages.append(message); } |
| 221 | 221 |
| 222 void removeLast() { m_messages.removeLast(); } | 222 void removeLast() { m_messages.pop_back(); } |
| 223 | 223 |
| 224 // Join all of the string literals into a single String. | 224 // Join all of the string literals into a single String. |
| 225 String toString() const { | 225 String toString() const { |
| 226 if (m_messages.isEmpty()) | 226 if (m_messages.isEmpty()) |
| 227 return String(); | 227 return String(); |
| 228 | 228 |
| 229 StringBuilder result; | 229 StringBuilder result; |
| 230 const char* Separator = ": "; | 230 const char* Separator = ": "; |
| 231 | 231 |
| 232 size_t length = (m_messages.size() - 1) * strlen(Separator); | 232 size_t length = (m_messages.size() - 1) * strlen(Separator); |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 } // namespace | 1091 } // namespace |
| 1092 | 1092 |
| 1093 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, | 1093 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, |
| 1094 WebCryptoOperation op, | 1094 WebCryptoOperation op, |
| 1095 WebCryptoAlgorithm& algorithm, | 1095 WebCryptoAlgorithm& algorithm, |
| 1096 AlgorithmError* error) { | 1096 AlgorithmError* error) { |
| 1097 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); | 1097 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 } // namespace blink | 1100 } // namespace blink |
| OLD | NEW |