| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (name == "iso-8859-1" || name == "us-ascii") | 74 if (name == "iso-8859-1" || name == "us-ascii") |
| 75 return "windows-1252"; | 75 return "windows-1252"; |
| 76 return name; | 76 return name; |
| 77 } | 77 } |
| 78 | 78 |
| 79 String TextDecoder::decode(const BufferSource& input, | 79 String TextDecoder::decode(const BufferSource& input, |
| 80 const TextDecodeOptions& options, | 80 const TextDecodeOptions& options, |
| 81 ExceptionState& exceptionState) { | 81 ExceptionState& exceptionState) { |
| 82 ASSERT(!input.isNull()); | 82 ASSERT(!input.isNull()); |
| 83 if (input.isArrayBufferView()) { | 83 if (input.isArrayBufferView()) { |
| 84 const char* start = | 84 const char* start = static_cast<const char*>( |
| 85 static_cast<const char*>(input.getAsArrayBufferView()->baseAddress()); | 85 input.getAsArrayBufferView().view()->baseAddress()); |
| 86 size_t length = input.getAsArrayBufferView()->byteLength(); | 86 size_t length = input.getAsArrayBufferView().view()->byteLength(); |
| 87 return decode(start, length, options, exceptionState); | 87 return decode(start, length, options, exceptionState); |
| 88 } | 88 } |
| 89 ASSERT(input.isArrayBuffer()); | 89 ASSERT(input.isArrayBuffer()); |
| 90 const char* start = | 90 const char* start = |
| 91 static_cast<const char*>(input.getAsArrayBuffer()->data()); | 91 static_cast<const char*>(input.getAsArrayBuffer()->data()); |
| 92 size_t length = input.getAsArrayBuffer()->byteLength(); | 92 size_t length = input.getAsArrayBuffer()->byteLength(); |
| 93 return decode(start, length, options, exceptionState); | 93 return decode(start, length, options, exceptionState); |
| 94 } | 94 } |
| 95 | 95 |
| 96 String TextDecoder::decode(const char* start, | 96 String TextDecoder::decode(const char* start, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 return s; | 121 return s; |
| 122 } | 122 } |
| 123 | 123 |
| 124 String TextDecoder::decode(ExceptionState& exceptionState) { | 124 String TextDecoder::decode(ExceptionState& exceptionState) { |
| 125 TextDecodeOptions options; | 125 TextDecodeOptions options; |
| 126 return decode(nullptr, 0, options, exceptionState); | 126 return decode(nullptr, 0, options, exceptionState); |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |