OLD | NEW |
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); | 658 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); |
659 return; | 659 return; |
660 } | 660 } |
661 | 661 |
662 if (!isPaintable()) { | 662 if (!isPaintable()) { |
663 // If the canvas element's bitmap has no pixels | 663 // If the canvas element's bitmap has no pixels |
664 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR
OM_HERE, bind(&BlobCallback::handleEvent, callback, nullptr)); | 664 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR
OM_HERE, bind(&BlobCallback::handleEvent, callback, nullptr)); |
665 return; | 665 return; |
666 } | 666 } |
667 | 667 |
| 668 double startTime = WTF::monotonicallyIncreasingTime(); |
668 double quality = UndefinedQualityValue; | 669 double quality = UndefinedQualityValue; |
669 if (!qualityArgument.isEmpty()) { | 670 if (!qualityArgument.isEmpty()) { |
670 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); | 671 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); |
671 if (v8Value->IsNumber()) { | 672 if (v8Value->IsNumber()) { |
672 quality = v8Value.As<v8::Number>()->Value(); | 673 quality = v8Value.As<v8::Number>()->Value(); |
673 } | 674 } |
674 } | 675 } |
675 | 676 |
676 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal
lback); | 677 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal
lback); |
677 | 678 |
678 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); | 679 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); |
679 | 680 |
680 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD
ata->data(), encodingMimeType, imageData->size(), callback); | 681 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD
ata->data(), encodingMimeType, imageData->size(), callback, startTime); |
681 | 682 |
682 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp"); | 683 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp"); |
683 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality); | 684 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality); |
684 } | 685 } |
685 | 686 |
686 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) | 687 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) |
687 { | 688 { |
688 m_listeners.add(listener); | 689 m_listeners.add(listener); |
689 } | 690 } |
690 | 691 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 return m_context->getIdFromControl(element); | 1166 return m_context->getIdFromControl(element); |
1166 return String(); | 1167 return String(); |
1167 } | 1168 } |
1168 | 1169 |
1169 void HTMLCanvasElement::createSurfaceLayerBridge() | 1170 void HTMLCanvasElement::createSurfaceLayerBridge() |
1170 { | 1171 { |
1171 m_surfaceLayerBridge = adoptPtr(new CanvasSurfaceLayerBridge()); | 1172 m_surfaceLayerBridge = adoptPtr(new CanvasSurfaceLayerBridge()); |
1172 } | 1173 } |
1173 | 1174 |
1174 } // namespace blink | 1175 } // namespace blink |
OLD | NEW |