| 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "sky/engine/config.h" | 26 #include "sky/engine/config.h" |
| 27 | 27 |
| 28 #include "sky/engine/platform/graphics/Canvas2DLayerBridge.h" | 28 #include "sky/engine/platform/graphics/Canvas2DLayerBridge.h" |
| 29 | 29 |
| 30 #include "sky/engine/platform/TraceEvent.h" | 30 #include "sky/engine/platform/TraceEvent.h" |
| 31 #include "sky/engine/platform/graphics/Canvas2DLayerManager.h" | 31 #include "sky/engine/platform/graphics/Canvas2DLayerManager.h" |
| 32 #include "sky/engine/platform/graphics/ImageBuffer.h" | 32 #include "sky/engine/platform/graphics/ImageBuffer.h" |
| 33 #include "sky/engine/public/platform/Platform.h" | 33 #include "sky/engine/public/platform/Platform.h" |
| 34 #include "sky/engine/public/platform/WebCompositorSupport.h" | |
| 35 #include "sky/engine/public/platform/WebGraphicsContext3D.h" | 34 #include "sky/engine/public/platform/WebGraphicsContext3D.h" |
| 36 #include "sky/engine/public/platform/WebGraphicsContext3DProvider.h" | 35 #include "sky/engine/public/platform/WebGraphicsContext3DProvider.h" |
| 37 #include "sky/engine/wtf/RefCountedLeakCounter.h" | 36 #include "sky/engine/wtf/RefCountedLeakCounter.h" |
| 38 #include "third_party/skia/include/core/SkDevice.h" | 37 #include "third_party/skia/include/core/SkDevice.h" |
| 39 #include "third_party/skia/include/core/SkSurface.h" | 38 #include "third_party/skia/include/core/SkSurface.h" |
| 40 #include "third_party/skia/include/gpu/GrContext.h" | 39 #include "third_party/skia/include/gpu/GrContext.h" |
| 41 | 40 |
| 42 namespace { | 41 namespace { |
| 43 enum { | 42 enum { |
| 44 InvalidMailboxIndex = -1, | 43 InvalidMailboxIndex = -1, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 , m_next(0) | 90 , m_next(0) |
| 92 , m_prev(0) | 91 , m_prev(0) |
| 93 , m_lastImageId(0) | 92 , m_lastImageId(0) |
| 94 , m_releasedMailboxInfoIndex(InvalidMailboxIndex) | 93 , m_releasedMailboxInfoIndex(InvalidMailboxIndex) |
| 95 { | 94 { |
| 96 ASSERT(m_canvas); | 95 ASSERT(m_canvas); |
| 97 ASSERT(m_surface); | 96 ASSERT(m_surface); |
| 98 ASSERT(m_contextProvider); | 97 ASSERT(m_contextProvider); |
| 99 // Used by browser tests to detect the use of a Canvas2DLayerBridge. | 98 // Used by browser tests to detect the use of a Canvas2DLayerBridge. |
| 100 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); | 99 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); |
| 101 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT
extureLayer(this)); | 100 m_layer = nullptr; |
| 101 CRASH(); // No compositor. |
| 102 m_layer->setOpaque(opacityMode == Opaque); | 102 m_layer->setOpaque(opacityMode == Opaque); |
| 103 m_layer->setBlendBackgroundColor(opacityMode != Opaque); | 103 m_layer->setBlendBackgroundColor(opacityMode != Opaque); |
| 104 m_layer->setRateLimitContext(m_rateLimitingEnabled); | 104 m_layer->setRateLimitContext(m_rateLimitingEnabled); |
| 105 m_canvas->setNotificationClient(this); | 105 m_canvas->setNotificationClient(this); |
| 106 #ifndef NDEBUG | 106 #ifndef NDEBUG |
| 107 canvas2DLayerBridgeInstanceCounter.increment(); | 107 canvas2DLayerBridgeInstanceCounter.increment(); |
| 108 #endif | 108 #endif |
| 109 } | 109 } |
| 110 | 110 |
| 111 Canvas2DLayerBridge::~Canvas2DLayerBridge() | 111 Canvas2DLayerBridge::~Canvas2DLayerBridge() |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 // This copy constructor should only be used for Vector reallocation | 565 // This copy constructor should only be used for Vector reallocation |
| 566 // Assuming 'other' is to be destroyed, we transfer m_image and | 566 // Assuming 'other' is to be destroyed, we transfer m_image and |
| 567 // m_parentLayerBridge ownership rather than do a refcount dance. | 567 // m_parentLayerBridge ownership rather than do a refcount dance. |
| 568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
| 569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
| 570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
| 571 m_status = other.m_status; | 571 m_status = other.m_status; |
| 572 } | 572 } |
| 573 | 573 |
| 574 } // namespace blink | 574 } // namespace blink |
| OLD | NEW |