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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return StaticBitmapImage::create(surface->makeImageSnapshot()); | 118 return StaticBitmapImage::create(surface->makeImageSnapshot()); |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) | 123 inline HTMLCanvasElement::HTMLCanvasElement(Document& document) |
124 : HTMLElement(canvasTag, document), | 124 : HTMLElement(canvasTag, document), |
125 ContextLifecycleObserver(&document), | 125 ContextLifecycleObserver(&document), |
126 PageVisibilityObserver(document.page()), | 126 PageVisibilityObserver(document.page()), |
127 m_size(DefaultWidth, DefaultHeight), | 127 m_size(DefaultWidth, DefaultHeight), |
| 128 m_context(this, nullptr), |
128 m_ignoreReset(false), | 129 m_ignoreReset(false), |
129 m_externallyAllocatedMemory(0), | 130 m_externallyAllocatedMemory(0), |
130 m_originClean(true), | 131 m_originClean(true), |
131 m_didFailToCreateImageBuffer(false), | 132 m_didFailToCreateImageBuffer(false), |
132 m_imageBufferIsClear(false), | 133 m_imageBufferIsClear(false), |
133 m_numFramesSinceLastRenderingModeSwitch(0), | 134 m_numFramesSinceLastRenderingModeSwitch(0), |
134 m_pendingRenderingModeSwitch(false) { | 135 m_pendingRenderingModeSwitch(false) { |
135 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::CanvasCreated); | 136 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::CanvasCreated); |
136 UseCounter::count(document, UseCounter::HTMLCanvasElement); | 137 UseCounter::count(document, UseCounter::HTMLCanvasElement); |
137 } | 138 } |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 mojom::blink::OffscreenCanvasSurfacePtr service; | 1346 mojom::blink::OffscreenCanvasSurfacePtr service; |
1346 Platform::current()->interfaceProvider()->getInterface( | 1347 Platform::current()->interfaceProvider()->getInterface( |
1347 mojo::GetProxy(&service)); | 1348 mojo::GetProxy(&service)); |
1348 m_surfaceLayerBridge = | 1349 m_surfaceLayerBridge = |
1349 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); | 1350 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); |
1350 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), | 1351 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), |
1351 this->height()); | 1352 this->height()); |
1352 } | 1353 } |
1353 | 1354 |
1354 } // namespace blink | 1355 } // namespace blink |
OLD | NEW |