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

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

Issue 1637163002: Change to idle-task implementations in toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 String encodingMimeType = toEncodingMimeType(mimeType); 604 String encodingMimeType = toEncodingMimeType(mimeType);
605 605
606 ImageData* imageData = toImageData(BackBuffer); 606 ImageData* imageData = toImageData(BackBuffer);
607 // imageData unref its data, which we still keep alive for the async toBlob thread 607 // imageData unref its data, which we still keep alive for the async toBlob thread
608 ScopedDisposal<ImageData> disposer(imageData); 608 ScopedDisposal<ImageData> disposer(imageData);
609 // Add a ref to keep image data alive until completion of encoding 609 // Add a ref to keep image data alive until completion of encoding
610 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data()); 610 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data());
611 611
612 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback, scrip tState->executionContext()); 612 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback, scrip tState->executionContext());
613 613
614 asyncCreatorRef->scheduleAsyncBlobCreation(quality); 614 if (Platform::current()->isThreadedCompositingEnabled() && (encodingMimeType == DefaultMimeType)) {
615 asyncCreatorRef->scheduleAsyncBlobCreation(true);
616 } else {
617 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality);
618 }
615 } 619 }
616 620
617 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) 621 void HTMLCanvasElement::addListener(CanvasDrawListener* listener)
618 { 622 {
619 m_listeners.add(listener); 623 m_listeners.add(listener);
620 } 624 }
621 625
622 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener) 626 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener)
623 { 627 {
624 m_listeners.remove(listener); 628 m_listeners.remove(listener);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 } 1016 }
1013 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); 1017 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr);
1014 } 1018 }
1015 1019
1016 bool HTMLCanvasElement::isOpaque() const 1020 bool HTMLCanvasElement::isOpaque() const
1017 { 1021 {
1018 return m_context && !m_context->hasAlpha(); 1022 return m_context && !m_context->hasAlpha();
1019 } 1023 }
1020 1024
1021 } // namespace blink 1025 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698