| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); | 670 exceptionState.throwSecurityError("Tainted canvases may not be exported.
"); |
| 671 return; | 671 return; |
| 672 } | 672 } |
| 673 | 673 |
| 674 if (!isPaintable()) { | 674 if (!isPaintable()) { |
| 675 // If the canvas element's bitmap has no pixels | 675 // If the canvas element's bitmap has no pixels |
| 676 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR
OM_HERE, bind(&BlobCallback::handleEvent, callback, nullptr)); | 676 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR
OM_HERE, bind(&BlobCallback::handleEvent, callback, nullptr)); |
| 677 return; | 677 return; |
| 678 } | 678 } |
| 679 | 679 |
| 680 double startTime = WTF::monotonicallyIncreasingTime(); |
| 680 double quality = UndefinedQualityValue; | 681 double quality = UndefinedQualityValue; |
| 681 if (!qualityArgument.isEmpty()) { | 682 if (!qualityArgument.isEmpty()) { |
| 682 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); | 683 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); |
| 683 if (v8Value->IsNumber()) { | 684 if (v8Value->IsNumber()) { |
| 684 quality = v8Value.As<v8::Number>()->Value(); | 685 quality = v8Value.As<v8::Number>()->Value(); |
| 685 } | 686 } |
| 686 } | 687 } |
| 687 | 688 |
| 688 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal
lback); | 689 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal
lback); |
| 689 | 690 |
| 690 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); | 691 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); |
| 691 | 692 |
| 692 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD
ata->data(), encodingMimeType, imageData->size(), callback); | 693 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD
ata->data(), encodingMimeType, imageData->size(), callback, startTime); |
| 693 | 694 |
| 694 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp"); | 695 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp"); |
| 695 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality); | 696 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality); |
| 696 } | 697 } |
| 697 | 698 |
| 698 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) | 699 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) |
| 699 { | 700 { |
| 700 m_listeners.add(listener); | 701 m_listeners.add(listener); |
| 701 } | 702 } |
| 702 | 703 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 return m_context->getIdFromControl(element); | 1184 return m_context->getIdFromControl(element); |
| 1184 return String(); | 1185 return String(); |
| 1185 } | 1186 } |
| 1186 | 1187 |
| 1187 void HTMLCanvasElement::createSurfaceLayerBridge() | 1188 void HTMLCanvasElement::createSurfaceLayerBridge() |
| 1188 { | 1189 { |
| 1189 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge()); | 1190 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge()); |
| 1190 } | 1191 } |
| 1191 | 1192 |
| 1192 } // namespace blink | 1193 } // namespace blink |
| OLD | NEW |