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& exception_state) { | 81 ExceptionState& exception_state) { |
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, exception_state); | 87 return decode(start, length, options, exception_state); |
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, exception_state); | 93 return decode(start, length, options, exception_state); |
94 } | 94 } |
95 | 95 |
96 String TextDecoder::decode(const char* start, | 96 String TextDecoder::decode(const char* start, |
(...skipping 24 matching lines...) Expand all Loading... |
121 | 121 |
122 return s; | 122 return s; |
123 } | 123 } |
124 | 124 |
125 String TextDecoder::decode(ExceptionState& exception_state) { | 125 String TextDecoder::decode(ExceptionState& exception_state) { |
126 TextDecodeOptions options; | 126 TextDecodeOptions options; |
127 return decode(nullptr, 0, options, exception_state); | 127 return decode(nullptr, 0, options, exception_state); |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |