Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: sky/engine/platform/graphics/Canvas2DLayerBridge.cpp

Issue 763013002: Get rid of the remaining uses of GraphicsLayer. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix diff Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 , m_releasedMailboxInfoIndex(InvalidMailboxIndex) 93 , m_releasedMailboxInfoIndex(InvalidMailboxIndex)
94 { 94 {
95 ASSERT(m_canvas); 95 ASSERT(m_canvas);
96 ASSERT(m_surface); 96 ASSERT(m_surface);
97 ASSERT(m_contextProvider); 97 ASSERT(m_contextProvider);
98 // Used by browser tests to detect the use of a Canvas2DLayerBridge. 98 // Used by browser tests to detect the use of a Canvas2DLayerBridge.
99 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_ SCOPE_NAME_PROCESS); 99 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_ SCOPE_NAME_PROCESS);
100 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this)); 100 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this));
101 m_layer->setOpaque(opacityMode == Opaque); 101 m_layer->setOpaque(opacityMode == Opaque);
102 m_layer->setBlendBackgroundColor(opacityMode != Opaque); 102 m_layer->setBlendBackgroundColor(opacityMode != Opaque);
103 GraphicsLayer::registerContentsLayer(m_layer->layer());
104 m_layer->setRateLimitContext(m_rateLimitingEnabled); 103 m_layer->setRateLimitContext(m_rateLimitingEnabled);
105 m_canvas->setNotificationClient(this); 104 m_canvas->setNotificationClient(this);
106 #ifndef NDEBUG 105 #ifndef NDEBUG
107 canvas2DLayerBridgeInstanceCounter.increment(); 106 canvas2DLayerBridgeInstanceCounter.increment();
108 #endif 107 #endif
109 } 108 }
110 109
111 Canvas2DLayerBridge::~Canvas2DLayerBridge() 110 Canvas2DLayerBridge::~Canvas2DLayerBridge()
112 { 111 {
113 ASSERT(m_destructionInProgress); 112 ASSERT(m_destructionInProgress);
(...skipping 15 matching lines...) Expand all
129 128
130 void Canvas2DLayerBridge::beginDestruction() 129 void Canvas2DLayerBridge::beginDestruction()
131 { 130 {
132 ASSERT(!m_destructionInProgress); 131 ASSERT(!m_destructionInProgress);
133 setRateLimitingEnabled(false); 132 setRateLimitingEnabled(false);
134 m_canvas->silentFlush(); 133 m_canvas->silentFlush();
135 m_imageBuffer = 0; 134 m_imageBuffer = 0;
136 freeTransientResources(); 135 freeTransientResources();
137 setIsHidden(true); 136 setIsHidden(true);
138 m_destructionInProgress = true; 137 m_destructionInProgress = true;
139 GraphicsLayer::unregisterContentsLayer(m_layer->layer());
140 m_canvas->setNotificationClient(0); 138 m_canvas->setNotificationClient(0);
141 m_surface.clear(); 139 m_surface.clear();
142 m_canvas.clear(); 140 m_canvas.clear();
143 m_layer->clearTexture(); 141 m_layer->clearTexture();
144 // Orphaning the layer is required to trigger the recration of a new layer 142 // Orphaning the layer is required to trigger the recration of a new layer
145 // in the case where destruction is caused by a canvas resize. Test: 143 // in the case where destruction is caused by a canvas resize. Test:
146 // virtual/gpu/fast/canvas/canvas-resize-after-paint-without-layout.html 144 // virtual/gpu/fast/canvas/canvas-resize-after-paint-without-layout.html
147 m_layer->layer()->removeFromParent(); 145 m_layer->layer()->removeFromParent();
148 // To anyone who ever hits this assert: Please update crbug.com/344666 146 // To anyone who ever hits this assert: Please update crbug.com/344666
149 // with repro steps. 147 // with repro steps.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // This copy constructor should only be used for Vector reallocation 565 // This copy constructor should only be used for Vector reallocation
568 // Assuming 'other' is to be destroyed, we transfer m_image and 566 // Assuming 'other' is to be destroyed, we transfer m_image and
569 // m_parentLayerBridge ownership rather than do a refcount dance. 567 // m_parentLayerBridge ownership rather than do a refcount dance.
570 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
571 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); 569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release();
572 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge. release(); 570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge. release();
573 m_status = other.m_status; 571 m_status = other.m_status;
574 } 572 }
575 573
576 } // namespace blink 574 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.cpp ('k') | sky/engine/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698