Chromium Code Reviews| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |