| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "platform/graphics/Canvas2DLayerBridge.h" | 28 #include "platform/graphics/Canvas2DLayerBridge.h" |
| 29 | 29 |
| 30 #include "GrContext.h" | 30 #include "GrContext.h" |
| 31 #include "SkDevice.h" | 31 #include "SkDevice.h" |
| 32 #include "SkSurface.h" | 32 #include "SkSurface.h" |
| 33 | 33 |
| 34 #include "platform/TraceEvent.h" | 34 #include "platform/TraceEvent.h" |
| 35 #include "platform/graphics/CanvasMetrics.h" |
| 35 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 36 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 36 #include "platform/graphics/GraphicsLayer.h" | 37 #include "platform/graphics/GraphicsLayer.h" |
| 37 #include "platform/graphics/ImageBuffer.h" | 38 #include "platform/graphics/ImageBuffer.h" |
| 38 #include "platform/graphics/gpu/SharedContextRateLimiter.h" | 39 #include "platform/graphics/gpu/SharedContextRateLimiter.h" |
| 39 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
| 40 #include "public/platform/WebCompositorSupport.h" | 41 #include "public/platform/WebCompositorSupport.h" |
| 41 #include "public/platform/WebGraphicsContext3D.h" | 42 #include "public/platform/WebGraphicsContext3D.h" |
| 42 #include "public/platform/WebGraphicsContext3DProvider.h" | 43 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 43 #include "third_party/skia/include/core/SkData.h" | 44 #include "third_party/skia/include/core/SkData.h" |
| 44 #include "third_party/skia/include/core/SkPictureRecorder.h" | 45 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 if (!m_surface) | 372 if (!m_surface) |
| 372 return false; | 373 return false; |
| 373 if (m_contextProvider->context3d()->isContextLost()) { | 374 if (m_contextProvider->context3d()->isContextLost()) { |
| 374 m_surface.clear(); | 375 m_surface.clear(); |
| 375 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes.
end(); ++mailboxInfo) { | 376 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes.
end(); ++mailboxInfo) { |
| 376 if (mailboxInfo->m_image) | 377 if (mailboxInfo->m_image) |
| 377 mailboxInfo->m_image.clear(); | 378 mailboxInfo->m_image.clear(); |
| 378 } | 379 } |
| 379 if (m_imageBuffer) | 380 if (m_imageBuffer) |
| 380 m_imageBuffer->notifySurfaceInvalid(); | 381 m_imageBuffer->notifySurfaceInvalid(); |
| 382 CanvasMetrics::countCanvasContextStat(CanvasMetrics::Accelerated2DCanvas
GPUContextLost); |
| 381 } | 383 } |
| 382 return m_surface; | 384 return m_surface; |
| 383 } | 385 } |
| 384 | 386 |
| 385 bool Canvas2DLayerBridge::restoreSurface() | 387 bool Canvas2DLayerBridge::restoreSurface() |
| 386 { | 388 { |
| 387 ASSERT(!m_destructionInProgress); | 389 ASSERT(!m_destructionInProgress); |
| 388 if (m_destructionInProgress) | 390 if (m_destructionInProgress) |
| 389 return false; | 391 return false; |
| 390 ASSERT(isAccelerated() && !m_surface); | 392 ASSERT(isAccelerated() && !m_surface); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 } | 648 } |
| 647 | 649 |
| 648 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) | 650 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) |
| 649 { | 651 { |
| 650 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 652 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
| 651 m_image = other.m_image; | 653 m_image = other.m_image; |
| 652 m_parentLayerBridge = other.m_parentLayerBridge; | 654 m_parentLayerBridge = other.m_parentLayerBridge; |
| 653 } | 655 } |
| 654 | 656 |
| 655 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |