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

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

Issue 1964183004: Revert of Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 if (v8Value->IsNumber()) { 639 if (v8Value->IsNumber()) {
640 quality = v8Value.As<v8::Number>()->Value(); 640 quality = v8Value.As<v8::Number>()->Value();
641 } 641 }
642 } 642 }
643 643
644 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal lback); 644 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal lback);
645 645
646 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); 646 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob);
647 // imageData unref its data, which we still keep alive for the async toBlob thread 647 // imageData unref its data, which we still keep alive for the async toBlob thread
648 ScopedDisposal<ImageData> disposer(imageData); 648 ScopedDisposal<ImageData> disposer(imageData);
649 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD ata->data(), encodingMimeType, imageData->size(), callback); 649 // Add a ref to keep image data alive until completion of encoding
650 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data());
650 651
651 if (encodingMimeType == DefaultMimeType) 652 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback);
652 asyncCreator->scheduleAsyncBlobCreation(true); 653
653 else 654 if (encodingMimeType == DefaultMimeType) {
654 asyncCreator->scheduleAsyncBlobCreation(false, quality); 655 asyncCreatorRef->scheduleAsyncBlobCreation(true);
656 } else {
657 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality);
658 }
655 } 659 }
656 660
657 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) 661 void HTMLCanvasElement::addListener(CanvasDrawListener* listener)
658 { 662 {
659 m_listeners.add(listener); 663 m_listeners.add(listener);
660 } 664 }
661 665
662 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener) 666 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener)
663 { 667 {
664 m_listeners.remove(listener); 668 m_listeners.remove(listener);
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 } 1120 }
1117 1121
1118 std::pair<Element*, String> HTMLCanvasElement::getControlAndIdIfHitRegionExists( const LayoutPoint& location) 1122 std::pair<Element*, String> HTMLCanvasElement::getControlAndIdIfHitRegionExists( const LayoutPoint& location)
1119 { 1123 {
1120 if (m_context && m_context->is2d()) 1124 if (m_context && m_context->is2d())
1121 return m_context->getControlAndIdIfHitRegionExists(location); 1125 return m_context->getControlAndIdIfHitRegionExists(location);
1122 return std::make_pair(nullptr, String()); 1126 return std::make_pair(nullptr, String());
1123 } 1127 }
1124 1128
1125 } // namespace blink 1129 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp ('k') | third_party/WebKit/Source/core/html/ImageData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698