OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (!m_layerRendererInitialized) { | 289 if (!m_layerRendererInitialized) { |
290 initializeLayerRenderer(); | 290 initializeLayerRenderer(); |
291 if (!m_layerRendererInitialized) | 291 if (!m_layerRendererInitialized) |
292 return false; | 292 return false; |
293 } | 293 } |
294 if (m_contextLost) { | 294 if (m_contextLost) { |
295 if (recreateContext() != RecreateSucceeded) | 295 if (recreateContext() != RecreateSucceeded) |
296 return false; | 296 return false; |
297 } | 297 } |
298 m_triggerIdlePaints = false; | 298 m_triggerIdlePaints = false; |
299 | |
300 // If the texture manager's limit is set to zero (e.g. invisible tab) | |
301 // we won't be able to paint. We temporarily set it to a non-zero value | |
302 // and bring it back down to zero after we composite and read-back. | |
303 bool needsAllocationReset = false; | |
304 bool savedMemoryAllocationsIsForDisplay = false; | |
305 if (!m_memoryAllocationBytes) { | |
306 needsAllocationReset = true; | |
307 savedMemoryAllocationsIsForDisplay = m_memoryAllocationIsForDisplay; | |
308 | |
309 m_memoryAllocationBytes = TextureManager::highLimitBytes(viewportSize())
; | |
310 m_memoryAllocationIsForDisplay = m_visible; | |
311 } | |
312 | |
313 bool ret = m_proxy->compositeAndReadback(pixels, rect); | 299 bool ret = m_proxy->compositeAndReadback(pixels, rect); |
314 | |
315 // Set texture manager's limit back to zero. | |
316 if (needsAllocationReset) { | |
317 setContentsMemoryAllocationLimitBytes(0); | |
318 m_memoryAllocationIsForDisplay = savedMemoryAllocationsIsForDisplay; | |
319 } | |
320 | |
321 m_triggerIdlePaints = true; | 300 m_triggerIdlePaints = true; |
322 return ret; | 301 return ret; |
323 } | 302 } |
324 | 303 |
325 void CCLayerTreeHost::finishAllRendering() | 304 void CCLayerTreeHost::finishAllRendering() |
326 { | 305 { |
327 if (!m_layerRendererInitialized) | 306 if (!m_layerRendererInitialized) |
328 return; | 307 return; |
329 m_proxy->finishAllRendering(); | 308 m_proxy->finishAllRendering(); |
330 } | 309 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 return; | 392 return; |
414 | 393 |
415 m_visible = visible; | 394 m_visible = visible; |
416 | 395 |
417 // FIXME: Remove this stuff, it is here just for the m20 merge. | 396 // FIXME: Remove this stuff, it is here just for the m20 merge. |
418 if (!m_visible && m_layerRendererInitialized) { | 397 if (!m_visible && m_layerRendererInitialized) { |
419 if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer) | 398 if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer) |
420 setContentsMemoryAllocationLimitBytes(0); | 399 setContentsMemoryAllocationLimitBytes(0); |
421 else | 400 else |
422 setContentsMemoryAllocationLimitBytes(m_contentsTextureManager->pref
erredMemoryLimitBytes()); | 401 setContentsMemoryAllocationLimitBytes(m_contentsTextureManager->pref
erredMemoryLimitBytes()); |
423 } else { | |
424 setNeedsForcedCommit(); | |
425 } | 402 } |
| 403 |
| 404 setNeedsForcedCommit(); |
426 } | 405 } |
427 | 406 |
428 void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes) | 407 void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes) |
429 { | 408 { |
430 ASSERT(CCProxy::isMainThread()); | 409 ASSERT(CCProxy::isMainThread()); |
431 if (m_memoryAllocationBytes == bytes) | 410 if (m_memoryAllocationBytes == bytes) |
432 return; | 411 return; |
433 | 412 |
434 m_memoryAllocationBytes = bytes; | 413 m_memoryAllocationBytes = bytes; |
435 m_memoryAllocationIsForDisplay = bytes; | 414 m_memoryAllocationIsForDisplay = bytes; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 else | 705 else |
727 layer->notifyAnimationFinished(wallClockTime); | 706 layer->notifyAnimationFinished(wallClockTime); |
728 } | 707 } |
729 } | 708 } |
730 | 709 |
731 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 710 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
732 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 711 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
733 } | 712 } |
734 | 713 |
735 } // namespace WebCore | 714 } // namespace WebCore |
OLD | NEW |