| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 struct AlgorithmInfo { | 123 struct AlgorithmInfo { |
| 124 AlgorithmInfo() | 124 AlgorithmInfo() |
| 125 : algorithmName(0) | 125 : algorithmName(0) |
| 126 { | 126 { |
| 127 for (size_t i = 0; i < WTF_ARRAY_LENGTH(paramsForOperation); ++i) | 127 for (size_t i = 0; i < WTF_ARRAY_LENGTH(paramsForOperation); ++i) |
| 128 paramsForOperation[i] = UnsupportedOp; | 128 paramsForOperation[i] = UnsupportedOp; |
| 129 } | 129 } |
| 130 | 130 |
| 131 blink::WebCryptoAlgorithmId algorithmId; | 131 blink::WebCryptoAlgorithmId algorithmId; |
| 132 const char* algorithmName; | 132 const char* algorithmName; |
| 133 AlgorithmParamsForOperation paramsForOperation[NumberOfAlgorithmOperations]; | 133 AlgorithmParamsForOperation paramsForOperation[LastAlgorithmOperation + 1]; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 // AlgorithmRegistry enumerates each of the different algorithms and its | 136 // AlgorithmRegistry enumerates each of the different algorithms and its |
| 137 // parameters. This describes the same information as the static tables above, | 137 // parameters. This describes the same information as the static tables above, |
| 138 // but in a more convenient runtime form. | 138 // but in a more convenient runtime form. |
| 139 class AlgorithmRegistry { | 139 class AlgorithmRegistry { |
| 140 public: | 140 public: |
| 141 static AlgorithmRegistry& instance(); | 141 static AlgorithmRegistry& instance(); |
| 142 | 142 |
| 143 const AlgorithmInfo* lookupAlgorithmByName(const String&) const; | 143 const AlgorithmInfo* lookupAlgorithmByName(const String&) const; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 { | 537 { |
| 538 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio
nState); | 538 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio
nState); |
| 539 } | 539 } |
| 540 | 540 |
| 541 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) | 541 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) |
| 542 { | 542 { |
| 543 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; | 543 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; |
| 544 } | 544 } |
| 545 | 545 |
| 546 } // namespace WebCore | 546 } // namespace WebCore |
| OLD | NEW |