| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 m_numFramesSinceLastRenderingModeSwitch++; | 343 m_numFramesSinceLastRenderingModeSwitch++; |
| 344 if (RuntimeEnabledFeatures:: | 344 if (RuntimeEnabledFeatures:: |
| 345 enableCanvas2dDynamicRenderingModeSwitchingEnabled() && | 345 enableCanvas2dDynamicRenderingModeSwitchingEnabled() && |
| 346 !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled()) { | 346 !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled()) { |
| 347 if (m_context->is2d() && buffer() && buffer()->isAccelerated() && | 347 if (m_context->is2d() && buffer() && buffer()->isAccelerated() && |
| 348 m_numFramesSinceLastRenderingModeSwitch >= | 348 m_numFramesSinceLastRenderingModeSwitch >= |
| 349 ExpensiveCanvasHeuristicParameters::MinFramesBeforeSwitch && | 349 ExpensiveCanvasHeuristicParameters::MinFramesBeforeSwitch && |
| 350 !m_pendingRenderingModeSwitch) { | 350 !m_pendingRenderingModeSwitch) { |
| 351 if (!m_context->isAccelerationOptimalForCanvasContent()) { | 351 if (!m_context->isAccelerationOptimalForCanvasContent()) { |
| 352 // The switch must be done asynchronously in order to avoid switching du
ring the paint invalidation step. | 352 // The switch must be done asynchronously in order to avoid switching du
ring the paint invalidation step. |
| 353 Platform::current()->currentThread()->getWebTaskRunner()->postTask( | 353 TaskRunnerHelper::get(TaskType::Internal, getExecutionContext()) |
| 354 BLINK_FROM_HERE, | 354 ->postTask( |
| 355 WTF::bind( | 355 BLINK_FROM_HERE, |
| 356 [](WeakPtr<ImageBuffer> buffer) { | 356 WTF::bind(&ImageBuffer::disableAcceleration, |
| 357 if (buffer) { | 357 m_imageBuffer->m_weakPtrFactory.createWeakPtr())); |
| 358 buffer->disableAcceleration(); | |
| 359 } | |
| 360 }, | |
| 361 m_imageBuffer->m_weakPtrFactory.createWeakPtr())); | |
| 362 m_numFramesSinceLastRenderingModeSwitch = 0; | 358 m_numFramesSinceLastRenderingModeSwitch = 0; |
| 363 m_pendingRenderingModeSwitch = true; | 359 m_pendingRenderingModeSwitch = true; |
| 364 } | 360 } |
| 365 } | 361 } |
| 366 } | 362 } |
| 367 | 363 |
| 368 if (m_pendingRenderingModeSwitch && buffer() && !buffer()->isAccelerated()) { | 364 if (m_pendingRenderingModeSwitch && buffer() && !buffer()->isAccelerated()) { |
| 369 m_pendingRenderingModeSwitch = false; | 365 m_pendingRenderingModeSwitch = false; |
| 370 } | 366 } |
| 371 | 367 |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 mojom::blink::OffscreenCanvasSurfacePtr service; | 1415 mojom::blink::OffscreenCanvasSurfacePtr service; |
| 1420 Platform::current()->interfaceProvider()->getInterface( | 1416 Platform::current()->interfaceProvider()->getInterface( |
| 1421 mojo::GetProxy(&service)); | 1417 mojo::GetProxy(&service)); |
| 1422 m_surfaceLayerBridge = | 1418 m_surfaceLayerBridge = |
| 1423 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); | 1419 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); |
| 1424 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), | 1420 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), |
| 1425 this->height()); | 1421 this->height()); |
| 1426 } | 1422 } |
| 1427 | 1423 |
| 1428 } // namespace blink | 1424 } // namespace blink |
| OLD | NEW |