Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: Source/core/html/canvas/DataView.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 default: 126 default:
127 ASSERT_NOT_REACHED(); 127 ASSERT_NOT_REACHED();
128 break; 128 break;
129 } 129 }
130 } 130 }
131 131
132 template<typename T> 132 template<typename T>
133 T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionState& es) const 133 T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionState& es) const
134 { 134 {
135 if (beyondRange<T>(byteOffset)) { 135 if (beyondRange<T>(byteOffset)) {
136 es.throwDOMException(IndexSizeError); 136 es.throwUninformativeAndGenericDOMException(IndexSizeError);
137 return 0; 137 return 0;
138 } 138 }
139 139
140 // We do not want to load the data directly since it would cause a bus error on architectures that don't support unaligned loads. 140 // We do not want to load the data directly since it would cause a bus error on architectures that don't support unaligned loads.
141 Value<T> value; 141 Value<T> value;
142 memcpy(value.bytes, static_cast<const char*>(m_baseAddress) + byteOffset, si zeof(T)); 142 memcpy(value.bytes, static_cast<const char*>(m_baseAddress) + byteOffset, si zeof(T));
143 flipBytesIfNeeded(value.bytes, sizeof(T), littleEndian); 143 flipBytesIfNeeded(value.bytes, sizeof(T), littleEndian);
144 return value.data; 144 return value.data;
145 } 145 }
146 146
147 template<typename T> 147 template<typename T>
148 void DataView::setData(unsigned byteOffset, T value, bool littleEndian, Exceptio nState& es) 148 void DataView::setData(unsigned byteOffset, T value, bool littleEndian, Exceptio nState& es)
149 { 149 {
150 if (beyondRange<T>(byteOffset)) { 150 if (beyondRange<T>(byteOffset)) {
151 es.throwDOMException(IndexSizeError); 151 es.throwUninformativeAndGenericDOMException(IndexSizeError);
152 return; 152 return;
153 } 153 }
154 154
155 // We do not want to store the data directly since it would cause a bus erro r on architectures that don't support unaligned stores. 155 // We do not want to store the data directly since it would cause a bus erro r on architectures that don't support unaligned stores.
156 Value<T> tempValue; 156 Value<T> tempValue;
157 tempValue.data = value; 157 tempValue.data = value;
158 flipBytesIfNeeded(tempValue.bytes, sizeof(T), littleEndian); 158 flipBytesIfNeeded(tempValue.bytes, sizeof(T), littleEndian);
159 memcpy(static_cast<char*>(m_baseAddress) + byteOffset, tempValue.bytes, size of(T)); 159 memcpy(static_cast<char*>(m_baseAddress) + byteOffset, tempValue.bytes, size of(T));
160 } 160 }
161 161
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 setData<double>(byteOffset, value, littleEndian, es); 239 setData<double>(byteOffset, value, littleEndian, es);
240 } 240 }
241 241
242 void DataView::neuter() 242 void DataView::neuter()
243 { 243 {
244 ArrayBufferView::neuter(); 244 ArrayBufferView::neuter();
245 m_byteLength = 0; 245 m_byteLength = 0;
246 } 246 }
247 247
248 } 248 }
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/html/forms/InputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698