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

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

Issue 2039673002: Track performance of toBlob and its complete timeout delay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 exceptionState.throwSecurityError("Tainted canvases may not be exported. "); 678 exceptionState.throwSecurityError("Tainted canvases may not be exported. ");
679 return; 679 return;
680 } 680 }
681 681
682 if (!isPaintable()) { 682 if (!isPaintable()) {
683 // If the canvas element's bitmap has no pixels 683 // If the canvas element's bitmap has no pixels
684 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, bind(&BlobCallback::handleEvent, wrapPersistent(callback), nullptr)); 684 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, bind(&BlobCallback::handleEvent, wrapPersistent(callback), nullptr));
685 return; 685 return;
686 } 686 }
687 687
688 double startTime = WTF::monotonicallyIncreasingTime();
688 double quality = UndefinedQualityValue; 689 double quality = UndefinedQualityValue;
689 if (!qualityArgument.isEmpty()) { 690 if (!qualityArgument.isEmpty()) {
690 v8::Local<v8::Value> v8Value = qualityArgument.v8Value(); 691 v8::Local<v8::Value> v8Value = qualityArgument.v8Value();
691 if (v8Value->IsNumber()) { 692 if (v8Value->IsNumber()) {
692 quality = v8Value.As<v8::Number>()->Value(); 693 quality = v8Value.As<v8::Number>()->Value();
693 } 694 }
694 } 695 }
695 696
696 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal lback); 697 String encodingMimeType = toEncodingMimeType(mimeType, EncodeReasonToBlobCal lback);
697 698
698 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob); 699 ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob);
699 700
700 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD ata->data(), encodingMimeType, imageData->size(), callback); 701 CanvasAsyncBlobCreator* asyncCreator = CanvasAsyncBlobCreator::create(imageD ata->data(), encodingMimeType, imageData->size(), callback, startTime);
701 702
702 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp"); 703 bool useIdlePeriodScheduling = (encodingMimeType != "image/webp");
703 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality); 704 asyncCreator->scheduleAsyncBlobCreation(useIdlePeriodScheduling, quality);
704 } 705 }
705 706
706 void HTMLCanvasElement::addListener(CanvasDrawListener* listener) 707 void HTMLCanvasElement::addListener(CanvasDrawListener* listener)
707 { 708 {
708 m_listeners.add(listener); 709 m_listeners.add(listener);
709 } 710 }
710 711
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 1195
1195 bool HTMLCanvasElement::createSurfaceLayer() 1196 bool HTMLCanvasElement::createSurfaceLayer()
1196 { 1197 {
1197 DCHECK(!m_surfaceLayerBridge); 1198 DCHECK(!m_surfaceLayerBridge);
1198 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); 1199 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl());
1199 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); 1200 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient)));
1200 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); 1201 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( ));
1201 } 1202 }
1202 1203
1203 } // namespace blink 1204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698