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

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

Issue 1108833003: Replacing v8::Handle<T> with v8::Local<T> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « Source/core/html/ImageData.h ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return nullptr; 137 return nullptr;
138 } 138 }
139 ASSERT(lengthInPixels && width); 139 ASSERT(lengthInPixels && width);
140 if (height != lengthInPixels / width) { 140 if (height != lengthInPixels / width) {
141 exceptionState.throwDOMException(IndexSizeError, "The input data byte le ngth is not equal to (4 * width * height)."); 141 exceptionState.throwDOMException(IndexSizeError, "The input data byte le ngth is not equal to (4 * width * height).");
142 return nullptr; 142 return nullptr;
143 } 143 }
144 return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data)); 144 return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data));
145 } 145 }
146 146
147 v8::Handle<v8::Object> ImageData::associateWithWrapper(v8::Isolate* isolate, con st WrapperTypeInfo* wrapperType, v8::Handle<v8::Object> wrapper) 147 v8::Local<v8::Object> ImageData::associateWithWrapper(v8::Isolate* isolate, cons t WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper)
148 { 148 {
149 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper); 149 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper);
150 150
151 if (!wrapper.IsEmpty() && m_data.get()) { 151 if (!wrapper.IsEmpty() && m_data.get()) {
152 // Create a V8 Uint8ClampedArray object and set the "data" property 152 // Create a V8 Uint8ClampedArray object and set the "data" property
153 // of the ImageData object to the created v8 object, eliminating the 153 // of the ImageData object to the created v8 object, eliminating the
154 // C++ callback when accessing the "data" property. 154 // C++ callback when accessing the "data" property.
155 v8::Handle<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate); 155 v8::Local<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate);
156 if (pixelArray.IsEmpty() || !v8CallBoolean(wrapper->ForceSet(isolate->Ge tCurrentContext(), v8AtomicString(isolate, "data"), pixelArray, v8::ReadOnly))) 156 if (pixelArray.IsEmpty() || !v8CallBoolean(wrapper->ForceSet(isolate->Ge tCurrentContext(), v8AtomicString(isolate, "data"), pixelArray, v8::ReadOnly)))
157 return v8::Handle<v8::Object>(); 157 return v8::Local<v8::Object>();
158 } 158 }
159 return wrapper; 159 return wrapper;
160 } 160 }
161 161
162 ImageData::ImageData(const IntSize& size) 162 ImageData::ImageData(const IntSize& size)
163 : m_size(size) 163 : m_size(size)
164 , m_data(DOMUint8ClampedArray::create(size.width() * size.height() * 4)) 164 , m_data(DOMUint8ClampedArray::create(size.width() * size.height() * 4))
165 { 165 {
166 } 166 }
167 167
168 ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteA rray) 168 ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteA rray)
169 : m_size(size) 169 : m_size(size)
170 , m_data(byteArray) 170 , m_data(byteArray)
171 { 171 {
172 ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.h eight() * 4) <= m_data->length()); 172 ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.h eight() * 4) <= m_data->length());
173 } 173 }
174 174
175 } // namespace blink 175 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/ImageData.h ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698