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

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

Issue 1491653002: Switch canvas.toBlob from idle-periods implementation to threaded implementation to allow experimen… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 String encodingMimeType = toEncodingMimeType(mimeType); 555 String encodingMimeType = toEncodingMimeType(mimeType);
556 556
557 ImageData* imageData = toImageData(BackBuffer); 557 ImageData* imageData = toImageData(BackBuffer);
558 // imageData unref its data, which we still keep alive for the async toBlob thread 558 // imageData unref its data, which we still keep alive for the async toBlob thread
559 ScopedDisposal<ImageData> disposer(imageData); 559 ScopedDisposal<ImageData> disposer(imageData);
560 // Add a ref to keep image data alive until completion of encoding 560 // Add a ref to keep image data alive until completion of encoding
561 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data()); 561 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data());
562 562
563 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback); 563 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback);
564 if (Platform::current()->isThreadedCompositingEnabled() && (encodingMimeType == DefaultMimeType)) { 564
565 asyncCreatorRef->scheduleAsyncBlobCreation(true); 565 // TODO(xlai): After Intent-to-Ship is approved, remove idle-periods version of implementation completely
Justin Novosad 2015/12/01 19:38:02 Create a crbug about this so we don't forget.
566 } else { 566 // if (Platform::current()->isThreadedCompositingEnabled() && (encodingMimeType == DefaultMimeType)) {
567 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality); 567 // asyncCreatorRef->scheduleAsyncBlobCreation(true);
568 } 568 // } else {
Justin Novosad 2015/12/01 19:38:02 Don't commit commented-out code
569 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality);
570 // }
569 } 571 }
570 572
571 SecurityOrigin* HTMLCanvasElement::securityOrigin() const 573 SecurityOrigin* HTMLCanvasElement::securityOrigin() const
572 { 574 {
573 return document().securityOrigin(); 575 return document().securityOrigin();
574 } 576 }
575 577
576 bool HTMLCanvasElement::originClean() const 578 bool HTMLCanvasElement::originClean() const
577 { 579 {
578 if (document().settings() && document().settings()->disableReadingFromCanvas ()) 580 if (document().settings() && document().settings()->disableReadingFromCanvas ())
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 954 }
953 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); 955 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr);
954 } 956 }
955 957
956 bool HTMLCanvasElement::isOpaque() const 958 bool HTMLCanvasElement::isOpaque() const
957 { 959 {
958 return m_context && !m_context->hasAlpha(); 960 return m_context && !m_context->hasAlpha();
959 } 961 }
960 962
961 } // blink 963 } // blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698