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 12 matching lines...) Expand all Loading... | |
| 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "core/html/HTMLCanvasElement.h" | 28 #include "core/html/HTMLCanvasElement.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/ExceptionMessages.h" | 30 #include "bindings/core/v8/ExceptionMessages.h" |
| 31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
| 32 #include "bindings/core/v8/ScriptController.h" | 32 #include "bindings/core/v8/ScriptController.h" |
| 33 #include "bindings/core/v8/ScriptWrappableVisitor.h" | |
| 33 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
| 34 #include "core/InputTypeNames.h" | 35 #include "core/InputTypeNames.h" |
| 35 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 36 #include "core/dom/Element.h" | 37 #include "core/dom/Element.h" |
| 37 #include "core/dom/ElementTraversal.h" | 38 #include "core/dom/ElementTraversal.h" |
| 38 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
| 39 #include "core/dom/TaskRunnerHelper.h" | 40 #include "core/dom/TaskRunnerHelper.h" |
| 40 #include "core/fileapi/File.h" | 41 #include "core/fileapi/File.h" |
| 41 #include "core/frame/ImageBitmap.h" | 42 #include "core/frame/ImageBitmap.h" |
| 42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 | 273 |
| 273 m_context = factory->create(this, attributes, document()); | 274 m_context = factory->create(this, attributes, document()); |
| 274 if (!m_context) | 275 if (!m_context) |
| 275 return nullptr; | 276 return nullptr; |
| 276 | 277 |
| 277 if (m_context->is3d()) { | 278 if (m_context->is3d()) { |
| 278 updateExternallyAllocatedMemory(); | 279 updateExternallyAllocatedMemory(); |
| 279 } | 280 } |
| 280 setNeedsCompositingUpdate(); | 281 setNeedsCompositingUpdate(); |
| 281 | 282 |
| 283 ScriptWrappableVisitor::writeBarrier(this, m_context); | |
|
Marcel Hlopko
2016/10/07 12:34:58
Nit: Can we move write barrier up to line 277?
Michael Lippautz
2016/10/07 12:48:52
Done.
| |
| 282 return m_context.get(); | 284 return m_context.get(); |
| 283 } | 285 } |
| 284 | 286 |
| 285 bool HTMLCanvasElement::shouldBeDirectComposited() const { | 287 bool HTMLCanvasElement::shouldBeDirectComposited() const { |
| 286 return (m_context && m_context->isAccelerated()) || | 288 return (m_context && m_context->isAccelerated()) || |
| 287 (hasImageBuffer() && buffer()->isExpensiveToPaint()) || | 289 (hasImageBuffer() && buffer()->isExpensiveToPaint()) || |
| 288 (!!m_surfaceLayerBridge); | 290 (!!m_surfaceLayerBridge); |
| 289 } | 291 } |
| 290 | 292 |
| 291 bool HTMLCanvasElement::isPaintable() const { | 293 bool HTMLCanvasElement::isPaintable() const { |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1439 mojom::blink::OffscreenCanvasSurfacePtr service; | 1441 mojom::blink::OffscreenCanvasSurfacePtr service; |
| 1440 Platform::current()->interfaceProvider()->getInterface( | 1442 Platform::current()->interfaceProvider()->getInterface( |
| 1441 mojo::GetProxy(&service)); | 1443 mojo::GetProxy(&service)); |
| 1442 m_surfaceLayerBridge = | 1444 m_surfaceLayerBridge = |
| 1443 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); | 1445 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); |
| 1444 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), | 1446 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), |
| 1445 this->height()); | 1447 this->height()); |
| 1446 } | 1448 } |
| 1447 | 1449 |
| 1448 } // namespace blink | 1450 } // namespace blink |
| OLD | NEW |