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

Side by Side Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 2193173002: Move ThreadableLoader to Oilpan heap (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-bridge-peer-in-worker-threadable-loader
Patch Set: rebase Created 4 years, 4 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) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 m_pendingLoaders.add(loader); 160 m_pendingLoaders.add(loader);
161 } 161 }
162 162
163 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader) 163 void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader)
164 { 164 {
165 ASSERT(m_pendingLoaders.contains(loader)); 165 ASSERT(m_pendingLoaders.contains(loader));
166 m_pendingLoaders.remove(loader); 166 m_pendingLoaders.remove(loader);
167 } 167 }
168 168
169 ImageBitmapFactories::ImageBitmapLoader::ImageBitmapLoader(ImageBitmapFactories& factory, Optional<IntRect> cropRect, ScriptState* scriptState, const ImageBitma pOptions& options) 169 ImageBitmapFactories::ImageBitmapLoader::ImageBitmapLoader(ImageBitmapFactories& factory, Optional<IntRect> cropRect, ScriptState* scriptState, const ImageBitma pOptions& options)
170 : m_loader(FileReaderLoader::ReadAsArrayBuffer, this) 170 : m_loader(FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer, thi s))
171 , m_factory(&factory) 171 , m_factory(&factory)
172 , m_resolver(ScriptPromiseResolver::create(scriptState)) 172 , m_resolver(ScriptPromiseResolver::create(scriptState))
173 , m_cropRect(cropRect) 173 , m_cropRect(cropRect)
174 , m_options(options) 174 , m_options(options)
175 { 175 {
176 } 176 }
177 177
178 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co ntext, Blob* blob) 178 void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* co ntext, Blob* blob)
179 { 179 {
180 m_loader.start(context, blob->blobDataHandle()); 180 m_loader->start(context, blob->blobDataHandle());
181 } 181 }
182 182
183 DEFINE_TRACE(ImageBitmapFactories) 183 DEFINE_TRACE(ImageBitmapFactories)
184 { 184 {
185 visitor->trace(m_pendingLoaders); 185 visitor->trace(m_pendingLoaders);
186 Supplement<LocalDOMWindow>::trace(visitor); 186 Supplement<LocalDOMWindow>::trace(visitor);
187 Supplement<WorkerGlobalScope>::trace(visitor); 187 Supplement<WorkerGlobalScope>::trace(visitor);
188 } 188 }
189 189
190 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() 190 void ImageBitmapFactories::ImageBitmapLoader::rejectPromise()
191 { 191 {
192 m_resolver->reject(DOMException::create(InvalidStateError, "The source image cannot be decoded.")); 192 m_resolver->reject(DOMException::create(InvalidStateError, "The source image cannot be decoded."));
193 m_factory->didFinishLoading(this); 193 m_factory->didFinishLoading(this);
194 } 194 }
195 195
196 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() 196 void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading()
197 { 197 {
198 DOMArrayBuffer* arrayBuffer = m_loader.arrayBufferResult(); 198 DOMArrayBuffer* arrayBuffer = m_loader->arrayBufferResult();
199 if (!arrayBuffer) { 199 if (!arrayBuffer) {
200 rejectPromise(); 200 rejectPromise();
201 return; 201 return;
202 } 202 }
203 scheduleAsyncImageBitmapDecoding(arrayBuffer); 203 scheduleAsyncImageBitmapDecoding(arrayBuffer);
204 } 204 }
205 205
206 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) 206 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
207 { 207 {
208 rejectPromise(); 208 rejectPromise();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 m_factory->didFinishLoading(this); 262 m_factory->didFinishLoading(this);
263 } 263 }
264 264
265 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) 265 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader)
266 { 266 {
267 visitor->trace(m_factory); 267 visitor->trace(m_factory);
268 visitor->trace(m_resolver); 268 visitor->trace(m_resolver);
269 } 269 }
270 270
271 } // namespace blink 271 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698