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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageData.cpp

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 v8::Isolate* isolate, 194 v8::Isolate* isolate,
195 const WrapperTypeInfo* wrapperType, 195 const WrapperTypeInfo* wrapperType,
196 v8::Local<v8::Object> wrapper) { 196 v8::Local<v8::Object> wrapper) {
197 wrapper = 197 wrapper =
198 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper); 198 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper);
199 199
200 if (!wrapper.IsEmpty() && m_data.get()) { 200 if (!wrapper.IsEmpty() && m_data.get()) {
201 // Create a V8 Uint8ClampedArray object and set the "data" property 201 // Create a V8 Uint8ClampedArray object and set the "data" property
202 // of the ImageData object to the created v8 object, eliminating the 202 // of the ImageData object to the created v8 object, eliminating the
203 // C++ callback when accessing the "data" property. 203 // C++ callback when accessing the "data" property.
204 v8::Local<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate); 204 v8::Local<v8::Value> pixelArray = ToV8(m_data.get(), wrapper, isolate);
205 if (pixelArray.IsEmpty() || 205 if (pixelArray.IsEmpty() ||
206 !v8CallBoolean(wrapper->DefineOwnProperty( 206 !v8CallBoolean(wrapper->DefineOwnProperty(
207 isolate->GetCurrentContext(), v8AtomicString(isolate, "data"), 207 isolate->GetCurrentContext(), v8AtomicString(isolate, "data"),
208 pixelArray, v8::ReadOnly))) 208 pixelArray, v8::ReadOnly)))
209 return v8::Local<v8::Object>(); 209 return v8::Local<v8::Object>();
210 } 210 }
211 return wrapper; 211 return wrapper;
212 } 212 }
213 213
214 ImageData::ImageData(const IntSize& size, DOMUint8ClampedArray* byteArray) 214 ImageData::ImageData(const IntSize& size, DOMUint8ClampedArray* byteArray)
215 : m_size(size), m_data(byteArray) { 215 : m_size(size), m_data(byteArray) {
216 DCHECK_GE(size.width(), 0); 216 DCHECK_GE(size.width(), 0);
217 DCHECK_GE(size.height(), 0); 217 DCHECK_GE(size.height(), 0);
218 SECURITY_CHECK(static_cast<unsigned>(size.width() * size.height() * 4) <= 218 SECURITY_CHECK(static_cast<unsigned>(size.width() * size.height() * 4) <=
219 m_data->length()); 219 m_data->length());
220 } 220 }
221 221
222 } // namespace blink 222 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698