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

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

Issue 698023005: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/inspector/ScriptArguments.cpp » ('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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!height) { 118 if (!height) {
119 height = length / width; 119 height = length / width;
120 } else if (height != length / width) { 120 } else if (height != length / width) {
121 exceptionState.throwDOMException(IndexSizeError, "The input data byte le ngth is not equal to (4 * width * height)."); 121 exceptionState.throwDOMException(IndexSizeError, "The input data byte le ngth is not equal to (4 * width * height).");
122 return nullptr; 122 return nullptr;
123 } 123 }
124 124
125 return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data)); 125 return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data));
126 } 126 }
127 127
128 v8::Handle<v8::Object> ImageData::associateWithWrapper(const WrapperTypeInfo* wr apperType, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) 128 v8::Handle<v8::Object> ImageData::associateWithWrapper(v8::Isolate* isolate, con st WrapperTypeInfo* wrapperType, v8::Handle<v8::Object> wrapper)
129 { 129 {
130 ScriptWrappable::associateWithWrapper(wrapperType, wrapper, isolate); 130 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper);
131 131
132 if (!wrapper.IsEmpty()) { 132 if (!wrapper.IsEmpty()) {
133 // Create a V8 Uint8ClampedArray object. 133 // Create a V8 Uint8ClampedArray object.
134 v8::Handle<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate); 134 v8::Handle<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate);
135 // Set the "data" property of the ImageData object to 135 // Set the "data" property of the ImageData object to
136 // the created v8 object, eliminating the C++ callback 136 // the created v8 object, eliminating the C++ callback
137 // when accessing the "data" property. 137 // when accessing the "data" property.
138 if (!pixelArray.IsEmpty()) 138 if (!pixelArray.IsEmpty())
139 wrapper->ForceSet(v8AtomicString(isolate, "data"), pixelArray, v8::R eadOnly); 139 wrapper->ForceSet(v8AtomicString(isolate, "data"), pixelArray, v8::R eadOnly);
140 } 140 }
141 return wrapper; 141 return wrapper;
142 } 142 }
143 143
144 ImageData::ImageData(const IntSize& size) 144 ImageData::ImageData(const IntSize& size)
145 : m_size(size) 145 : m_size(size)
146 , m_data(DOMUint8ClampedArray::create(size.width() * size.height() * 4)) 146 , m_data(DOMUint8ClampedArray::create(size.width() * size.height() * 4))
147 { 147 {
148 } 148 }
149 149
150 ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteA rray) 150 ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteA rray)
151 : m_size(size) 151 : m_size(size)
152 , m_data(byteArray) 152 , m_data(byteArray)
153 { 153 {
154 ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.h eight() * 4) <= m_data->length()); 154 ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.h eight() * 4) <= m_data->length());
155 } 155 }
156 156
157 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/ImageData.h ('k') | Source/core/inspector/ScriptArguments.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698