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: Remove this when slimming paint v2 is further along. This is only | |
chrishtr
2015/08/13 21:33:16
TODO(pdr)
pdr.
2015/08/14 00:10:29
Done
| |
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 if (m_painter->displayItemList()) { | |
98 for (auto& displayItem : m_painter->displayItemList()->displayItems( )) | |
99 displayItem.appendToWebDisplayItemList(webDisplayItemList); | |
100 } | |
101 return; | |
102 } | |
103 | |
93 DisplayItemList* displayItemList = m_painter->displayItemList(); | 104 DisplayItemList* displayItemList = m_painter->displayItemList(); |
94 ASSERT(displayItemList); | 105 ASSERT(displayItemList); |
95 displayItemList->setDisplayItemConstructionIsDisabled( | 106 displayItemList->setDisplayItemConstructionIsDisabled( |
96 paintingControl == WebContentLayerClient::DisplayListConstructionDisable d); | 107 paintingControl == WebContentLayerClient::DisplayListConstructionDisable d); |
97 | 108 |
98 // We also disable caching when Painting or Construction are disabled. In bo th cases we would like | 109 // 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. | 110 // to compare assuming the full cost of recording, not the cost of re-using cached content. |
100 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) | 111 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) |
101 displayItemList->invalidateAll(); | 112 displayItemList->invalidateAll(); |
102 | 113 |
103 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d; | 114 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d; |
104 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled | 115 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled |
105 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled) | 116 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled) |
106 disabledMode = GraphicsContext::FullyDisabled; | 117 disabledMode = GraphicsContext::FullyDisabled; |
107 GraphicsContext context(displayItemList, disabledMode); | 118 GraphicsContext context(displayItemList, disabledMode); |
108 | 119 |
109 m_painter->paint(context, clip); | 120 m_painter->paint(context, clip); |
110 | 121 |
111 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl ayItemList); | 122 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl ayItemList); |
112 } | 123 } |
113 | 124 |
114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 125 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
115 { | 126 { |
116 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); | 127 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); |
117 } | 128 } |
118 | 129 |
119 } // namespace blink | 130 } // namespace blink |
OLD | NEW |