Changeset 281661 in webkit
- Timestamp:
- Aug 26, 2021, 3:07:30 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Shared/ShareableBitmap.h (modified) (1 diff)
-
Shared/cg/ShareableBitmapCG.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r281646 r281661 1 2021-08-26 Cameron McCormack <heycam@apple.com> 2 3 Manually release SharedBitmap if CGBitmapContextCreateWithData fails and doesn't do it 4 https://bugs.webkit.org/show_bug.cgi?id=229428 5 <rdar://problem/82264138> 6 7 Reviewed by Darin Adler. 8 9 * Shared/ShareableBitmap.h: 10 * Shared/cg/ShareableBitmapCG.cpp: 11 (WebKit::ShareableBitmap::createGraphicsContext): 12 (WebKit::ShareableBitmap::releaseBitmapContextData): 13 1 14 2021-08-26 Aditya Keerthi <akeerthi@apple.com> 2 15 -
trunk/Source/WebKit/Shared/ShareableBitmap.h
r278351 r281661 177 177 #endif 178 178 179 #if USE(CG) 180 bool m_releaseBitmapContextDataCalled { false }; 181 #endif 182 179 183 // If the shareable bitmap is backed by shared memory, this points to the shared memory object. 180 184 RefPtr<SharedMemory> m_sharedMemory; -
trunk/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp
r278351 r281661 98 98 return nullptr; 99 99 100 ref(); // Balanced by deref in releaseBitmapContextData. 101 102 m_releaseBitmapContextDataCalled = false; 100 103 RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreateWithData(data(), m_size.width(), m_size.height(), bitsPerComponent, bytesPerRow, colorSpace(m_configuration), bitmapInfo(m_configuration), releaseBitmapContextData, this)); 101 if (!bitmapContext) 102 return nullptr; 103 104 ref(); // Balanced by deref in releaseBitmapContextData. 104 if (!bitmapContext) { 105 // When CGBitmapContextCreateWithData fails and returns null, it will only 106 // call the release callback in some circumstances <rdar://82228446>. We 107 // work around this by recording whether it was called, and calling it 108 // ourselves if needed. 109 if (!m_releaseBitmapContextDataCalled) 110 releaseBitmapContextData(this, this->data()); 111 return nullptr; 112 } 113 ASSERT(!m_releaseBitmapContextDataCalled); 105 114 106 115 // We want the origin to be in the top left corner so we flip the backing store context. … … 172 181 ShareableBitmap* bitmap = static_cast<ShareableBitmap*>(typelessBitmap); 173 182 ASSERT_UNUSED(typelessData, bitmap->data() == typelessData); 183 bitmap->m_releaseBitmapContextDataCalled = true; 174 184 bitmap->deref(); // Balanced by ref in createGraphicsContext. 175 185 }
Note:
See TracChangeset
for help on using the changeset viewer.