| 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 * 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ContentLayerDelegate::paintContents( | 85 void ContentLayerDelegate::paintContents( |
| 86 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 86 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
| 87 WebContentLayerClient::PaintingControlSetting paintingControl) | 87 WebContentLayerClient::PaintingControlSetting paintingControl) |
| 88 { | 88 { |
| 89 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 89 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
| 90 | 90 |
| 91 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 91 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 92 | 92 |
| 93 // TODO(pdr): Remove when slimming paint v2 is further along. This is only |
| 94 // here so the browser is usable during development and does not crash due |
| 95 // to committing the new display items twice. |
| 96 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 97 m_painter->displayItemList()->appendToWebDisplayItemList(webDisplayItemL
ist); |
| 98 return; |
| 99 } |
| 100 |
| 93 DisplayItemList* displayItemList = m_painter->displayItemList(); | 101 DisplayItemList* displayItemList = m_painter->displayItemList(); |
| 94 ASSERT(displayItemList); | 102 ASSERT(displayItemList); |
| 95 displayItemList->setDisplayItemConstructionIsDisabled( | 103 displayItemList->setDisplayItemConstructionIsDisabled( |
| 96 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); | 104 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); |
| 97 | 105 |
| 98 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like | 106 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like |
| 99 // to compare assuming the full cost of recording, not the cost of re-using
cached content. | 107 // to compare assuming the full cost of recording, not the cost of re-using
cached content. |
| 100 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) | 108 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) |
| 101 displayItemList->invalidateAll(); | 109 displayItemList->invalidateAll(); |
| 102 | 110 |
| 103 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; | 111 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; |
| 104 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled | 112 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled |
| 105 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) | 113 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) |
| 106 disabledMode = GraphicsContext::FullyDisabled; | 114 disabledMode = GraphicsContext::FullyDisabled; |
| 107 GraphicsContext context(displayItemList, disabledMode); | 115 GraphicsContext context(displayItemList, disabledMode); |
| 108 | 116 |
| 109 m_painter->paint(context, clip); | 117 m_painter->paint(context, clip); |
| 110 | 118 |
| 111 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl
ayItemList); | 119 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl
ayItemList); |
| 112 } | 120 } |
| 113 | 121 |
| 114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 122 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
| 115 { | 123 { |
| 116 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); | 124 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); |
| 117 } | 125 } |
| 118 | 126 |
| 119 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |