OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; | 62 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; |
63 if (!checkedMax.isValid() || checkedMax.value() > buffer->byteLength()) | 63 if (!checkedMax.isValid() || checkedMax.value() > buffer->byteLength()) |
64 return nullptr; | 64 return nullptr; |
65 return adoptRef(new DataView(buffer, byteOffset, byteLength)); | 65 return adoptRef(new DataView(buffer, byteOffset, byteLength)); |
66 } | 66 } |
67 | 67 |
68 DataView::DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned
byteLength) | 68 DataView::DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned
byteLength) |
69 : ArrayBufferView(buffer, byteOffset) | 69 : ArrayBufferView(buffer, byteOffset) |
70 , m_byteLength(byteLength) | 70 , m_byteLength(byteLength) |
71 { | 71 { |
72 ScriptWrappable::init(this); | |
73 } | 72 } |
74 | 73 |
75 static bool needToFlipBytes(bool littleEndian) | 74 static bool needToFlipBytes(bool littleEndian) |
76 { | 75 { |
77 #if CPU(BIG_ENDIAN) | 76 #if CPU(BIG_ENDIAN) |
78 return littleEndian; | 77 return littleEndian; |
79 #else | 78 #else |
80 return !littleEndian; | 79 return !littleEndian; |
81 #endif | 80 #endif |
82 } | 81 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return V8TypedArray<DataView>::wrap(this, creationContext, isolate); | 245 return V8TypedArray<DataView>::wrap(this, creationContext, isolate); |
247 } | 246 } |
248 | 247 |
249 void DataView::neuter() | 248 void DataView::neuter() |
250 { | 249 { |
251 ArrayBufferView::neuter(); | 250 ArrayBufferView::neuter(); |
252 m_byteLength = 0; | 251 m_byteLength = 0; |
253 } | 252 } |
254 | 253 |
255 } // namespace blink | 254 } // namespace blink |
OLD | NEW |