|
Lines 21-28
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec1
|
| 21 |
|
21 |
|
| 22 |
#include "PlatformContextSkia.h" |
22 |
#include "PlatformContextSkia.h" |
| 23 |
|
23 |
|
|
|
24 |
#include <BlackBerryPlatformExecutableMessage.h> |
| 24 |
#include <BlackBerryPlatformGraphics.h> |
25 |
#include <BlackBerryPlatformGraphics.h> |
| 25 |
#include <BlackBerryPlatformLog.h> |
26 |
#include <BlackBerryPlatformLog.h> |
|
|
27 |
#include <BlackBerryPlatformMessageClient.h> |
| 26 |
#include <BlackBerryPlatformMisc.h> |
28 |
#include <BlackBerryPlatformMisc.h> |
| 27 |
#include <BlackBerryPlatformScreen.h> |
29 |
#include <BlackBerryPlatformScreen.h> |
| 28 |
#include <BlackBerryPlatformSettings.h> |
30 |
#include <BlackBerryPlatformSettings.h> |
|
Lines 62-86
SurfacePool::SurfacePool()
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec2
|
| 62 |
{ |
64 |
{ |
| 63 |
} |
65 |
} |
| 64 |
|
66 |
|
| 65 |
void SurfacePool::initialize(const BlackBerry::Platform::IntSize& tileSize) |
67 |
void SurfacePool::initialize(const Platform::IntSize& tileSize) |
| 66 |
{ |
68 |
{ |
| 67 |
if (m_initialized) |
69 |
if (m_initialized) |
| 68 |
return; |
70 |
return; |
| 69 |
m_initialized = true; |
71 |
m_initialized = true; |
| 70 |
|
72 |
|
| 71 |
const unsigned numberOfTiles = BlackBerry::Platform::Settings::instance()->numberOfBackingStoreTiles(); |
73 |
const unsigned numberOfTiles = Platform::Settings::instance()->numberOfBackingStoreTiles(); |
| 72 |
const unsigned maxNumberOfTiles = BlackBerry::Platform::Settings::instance()->maximumNumberOfBackingStoreTilesAcrossProcesses(); |
74 |
const unsigned maxNumberOfTiles = Platform::Settings::instance()->maximumNumberOfBackingStoreTilesAcrossProcesses(); |
| 73 |
|
75 |
|
| 74 |
if (numberOfTiles) { // Only allocate if we actually use a backingstore. |
76 |
if (numberOfTiles) { // Only allocate if we actually use a backingstore. |
| 75 |
unsigned byteLimit = (maxNumberOfTiles /*pool*/ + 2 /*visible tile buffer, backbuffer*/) * tileSize.width() * tileSize.height() * 4; |
77 |
unsigned byteLimit = (maxNumberOfTiles /*pool*/ + 2 /*visible tile buffer, backbuffer*/) * tileSize.width() * tileSize.height() * 4; |
| 76 |
bool success = BlackBerry::Platform::Graphics::createPixmapGroup(SHARED_PIXMAP_GROUP, byteLimit); |
78 |
bool success = Platform::Graphics::createPixmapGroup(SHARED_PIXMAP_GROUP, byteLimit); |
| 77 |
if (!success) { |
79 |
if (!success) { |
| 78 |
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelWarn, |
80 |
Platform::log(Platform::LogLevelWarn, |
| 79 |
"Shared buffer pool could not be set up, using regular memory allocation instead."); |
81 |
"Shared buffer pool could not be set up, using regular memory allocation instead."); |
| 80 |
} |
82 |
} |
| 81 |
} |
83 |
} |
| 82 |
|
84 |
|
| 83 |
m_tileRenderingSurface = BlackBerry::Platform::Graphics::drawingSurface(); |
85 |
m_tileRenderingSurface = Platform::Graphics::drawingSurface(); |
| 84 |
|
86 |
|
| 85 |
if (!numberOfTiles) |
87 |
if (!numberOfTiles) |
| 86 |
return; // we only use direct rendering when 0 tiles are specified. |
88 |
return; // we only use direct rendering when 0 tiles are specified. |
|
Lines 113-119
void SurfacePool::initialize(const BlackBerry::Platform::IntSize& tileSize)
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec3
|
| 113 |
pthread_mutexattr_destroy(&attr); |
115 |
pthread_mutexattr_destroy(&attr); |
| 114 |
} |
116 |
} |
| 115 |
|
117 |
|
| 116 |
PlatformGraphicsContext* SurfacePool::createPlatformGraphicsContext(BlackBerry::Platform::Graphics::Drawable* drawable) const |
118 |
PlatformGraphicsContext* SurfacePool::createPlatformGraphicsContext(Platform::Graphics::Drawable* drawable) const |
| 117 |
{ |
119 |
{ |
| 118 |
return new WebCore::PlatformContextSkia(drawable); |
120 |
return new WebCore::PlatformContextSkia(drawable); |
| 119 |
} |
121 |
} |
|
Lines 123-129
PlatformGraphicsContext* SurfacePool::lockTileRenderingSurface() const
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec4
|
| 123 |
if (!m_tileRenderingSurface) |
125 |
if (!m_tileRenderingSurface) |
| 124 |
return 0; |
126 |
return 0; |
| 125 |
|
127 |
|
| 126 |
return createPlatformGraphicsContext(BlackBerry::Platform::Graphics::lockBufferDrawable(m_tileRenderingSurface)); |
128 |
return createPlatformGraphicsContext(Platform::Graphics::lockBufferDrawable(m_tileRenderingSurface)); |
| 127 |
} |
129 |
} |
| 128 |
|
130 |
|
| 129 |
void SurfacePool::releaseTileRenderingSurface(PlatformGraphicsContext* context) const |
131 |
void SurfacePool::releaseTileRenderingSurface(PlatformGraphicsContext* context) const |
|
Lines 132-141
void SurfacePool::releaseTileRenderingSurface(PlatformGraphicsContext* context)
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec5
|
| 132 |
return; |
134 |
return; |
| 133 |
|
135 |
|
| 134 |
delete context; |
136 |
delete context; |
| 135 |
BlackBerry::Platform::Graphics::releaseBufferDrawable(m_tileRenderingSurface); |
137 |
Platform::Graphics::releaseBufferDrawable(m_tileRenderingSurface); |
| 136 |
} |
138 |
} |
| 137 |
|
139 |
|
| 138 |
void SurfacePool::initializeVisibleTileBuffer(const BlackBerry::Platform::IntSize& visibleSize) |
140 |
void SurfacePool::initializeVisibleTileBuffer(const Platform::IntSize& visibleSize) |
| 139 |
{ |
141 |
{ |
| 140 |
if (!m_visibleTileBuffer || m_visibleTileBuffer->size() != visibleSize) { |
142 |
if (!m_visibleTileBuffer || m_visibleTileBuffer->size() != visibleSize) { |
| 141 |
delete m_visibleTileBuffer; |
143 |
delete m_visibleTileBuffer; |
|
Lines 161-173
void SurfacePool::createBuffers()
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec6
|
| 161 |
|
163 |
|
| 162 |
// Create the tile pool. |
164 |
// Create the tile pool. |
| 163 |
for (size_t i = 0; i < m_tilePool.size(); ++i) |
165 |
for (size_t i = 0; i < m_tilePool.size(); ++i) |
| 164 |
BlackBerry::Platform::Graphics::createPixmapBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer()); |
166 |
Platform::Graphics::createPixmapBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer()); |
| 165 |
|
167 |
|
| 166 |
if (m_visibleTileBuffer) |
168 |
if (m_visibleTileBuffer) |
| 167 |
BlackBerry::Platform::Graphics::createPixmapBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer()); |
169 |
Platform::Graphics::createPixmapBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer()); |
| 168 |
|
170 |
|
| 169 |
if (backBuffer()) |
171 |
if (backBuffer()) |
| 170 |
BlackBerry::Platform::Graphics::createPixmapBuffer(backBuffer()->nativeBuffer()); |
172 |
Platform::Graphics::createPixmapBuffer(backBuffer()->nativeBuffer()); |
| 171 |
|
173 |
|
| 172 |
m_buffersSuspended = false; |
174 |
m_buffersSuspended = false; |
| 173 |
} |
175 |
} |
|
Lines 183-203
void SurfacePool::releaseBuffers()
a/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp_sec7
|
| 183 |
for (size_t i = 0; i < m_tilePool.size(); ++i) { |
185 |
for (size_t i = 0; i < m_tilePool.size(); ++i) { |
| 184 |
m_tilePool[i]->frontBuffer()->clearRenderedRegion(); |
186 |
m_tilePool[i]->frontBuffer()->clearRenderedRegion(); |
| 185 |
// Clear the buffer to prevent accidental leakage of (possibly sensitive) pixel data. |
187 |
// Clear the buffer to prevent accidental leakage of (possibly sensitive) pixel data. |
| 186 |
BlackBerry::Platform::Graphics::clearBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer(), 0, 0, 0, 0); |
188 |
Platform::Graphics::clearBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer(), 0, 0, 0, 0); |
| 187 |
BlackBerry::Platform::Graphics::destroyPixmapBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer()); |
189 |
Platform::Graphics::destroyPixmapBuffer(m_tilePool[i]->frontBuffer()->nativeBuffer()); |
| 188 |
} |
190 |
} |
| 189 |
|
191 |
|
| 190 |
if (m_visibleTileBuffer) { |
192 |
if (m_visibleTileBuffer) { |
| 191 |
m_visibleTileBuffer->frontBuffer()->clearRenderedRegion(); |
193 |
m_visibleTileBuffer->frontBuffer()->clearRenderedRegion(); |
| 192 |
BlackBerry::Platform::Graphics::clearBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer(), 0, 0, 0, 0); |
194 |
Platform::Graphics::clearBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer(), 0, 0, 0, 0); |
| 193 |
BlackBerry::Platform::Graphics::destroyPixmapBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer()); |
195 |
Platform::Graphics::destroyPixmapBuffer(m_visibleTileBuffer->frontBuffer()->nativeBuffer()); |
| 194 |
} |
196 |
} |
| 195 |
|
197 |
|
| 196 |
if (backBuffer()) { |
198 |
if (backBuffer()) { |
| 197 |
backBuffer()->clearRenderedRegion(); |
199 |
backBuffer()->clearRenderedRegion(); |
| 198 |
BlackBerry::Platform::Graphics::clearBuffer(backBuffer()->nativeBuffer(), 0, 0, 0, 0); |
200 |
Platform::Graphics::clearBuffer(backBuffer()->nativeBuffer(), 0, 0, 0, 0); |
| 199 |
BlackBerry::Platform::Graphics::destroyPixmapBuffer(backBuffer()->nativeBuffer()); |
201 |
Platform::Graphics::destroyPixmapBuffer(backBuffer()->nativeBuffer()); |
| 200 |
} |
202 |
} |
|
|
203 |
|
| 204 |
Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( |
| 205 |
Platform::createFunctionCallMessage(&Platform::Graphics::collectThreadSpecificGarbage)); |
| 201 |
} |
206 |
} |
| 202 |
|
207 |
|
| 203 |
void SurfacePool::waitForBuffer(TileBuffer* tileBuffer) |
208 |
void SurfacePool::waitForBuffer(TileBuffer* tileBuffer) |