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

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

Issue 2019963002: Remove get from CrossThreadPersistent to avoid accidental use Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 5 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
6 6
7 #include "core/fileapi/Blob.h" 7 #include "core/fileapi/Blob.h"
8 #include "platform/ThreadSafeFunctional.h" 8 #include "platform/ThreadSafeFunctional.h"
9 #include "platform/graphics/ImageBuffer.h" 9 #include "platform/graphics/ImageBuffer.h"
10 #include "platform/image-encoders/JPEGImageEncoder.h" 10 #include "platform/image-encoders/JPEGImageEncoder.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 m_data.clear(); 271 m_data.clear();
272 m_callback.clear(); 272 m_callback.clear();
273 } 273 }
274 274
275 void CanvasAsyncBlobCreator::encodeImageOnEncoderThread(double quality) 275 void CanvasAsyncBlobCreator::encodeImageOnEncoderThread(double quality)
276 { 276 {
277 ASSERT(!isMainThread()); 277 ASSERT(!isMainThread());
278 ASSERT(m_mimeType == MimeTypeWebp); 278 ASSERT(m_mimeType == MimeTypeWebp);
279 279
280 if (!ImageDataBuffer(m_size, m_data->data()).encodeImage("image/webp", quali ty, m_encodedImage.get())) { 280 if (!ImageDataBuffer(m_size, m_data->data()).encodeImage("image/webp", quali ty, m_encodedImage.get())) {
281 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&BlobCallback::handleEvent, wrapCrossThreadPersistent(m_ callback.get()), nullptr)); 281 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&BlobCallback::handleEvent, wrapCrossThreadPersistent(m_ callback), nullptr));
282 return; 282 return;
283 } 283 }
284 284
285 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_H ERE, threadSafeBind(&CanvasAsyncBlobCreator::createBlobAndInvokeCallback, wrapCr ossThreadPersistent(this))); 285 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_H ERE, threadSafeBind(&CanvasAsyncBlobCreator::createBlobAndInvokeCallback, wrapCr ossThreadPersistent(this)));
286 } 286 }
287 287
288 bool CanvasAsyncBlobCreator::initializePngStruct() 288 bool CanvasAsyncBlobCreator::initializePngStruct()
289 { 289 {
290 m_pngEncoderState = PNGImageEncoderState::create(m_size, m_encodedImage.get( )); 290 m_pngEncoderState = PNGImageEncoderState::create(m_size, m_encodedImage.get( ));
291 if (!m_pngEncoderState) { 291 if (!m_pngEncoderState) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 361 }
362 } 362 }
363 363
364 void CanvasAsyncBlobCreator::postDelayedTaskToMainThread(const WebTraceLocation& location, std::unique_ptr<SameThreadClosure> task, double delayMs) 364 void CanvasAsyncBlobCreator::postDelayedTaskToMainThread(const WebTraceLocation& location, std::unique_ptr<SameThreadClosure> task, double delayMs)
365 { 365 {
366 DCHECK(isMainThread()); 366 DCHECK(isMainThread());
367 Platform::current()->mainThread()->getWebTaskRunner()->postDelayedTask(locat ion, std::move(task), delayMs); 367 Platform::current()->mainThread()->getWebTaskRunner()->postDelayedTask(locat ion, std::move(task), delayMs);
368 } 368 }
369 369
370 } // namespace blink 370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698