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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 PaintController& paintController = m_graphicsLayer->getPaintController(); | 77 PaintController& paintController = m_graphicsLayer->getPaintController(); |
78 paintController.setDisplayItemConstructionIsDisabled( | 78 paintController.setDisplayItemConstructionIsDisabled( |
79 paintingControl == | 79 paintingControl == |
80 WebContentLayerClient::DisplayListConstructionDisabled); | 80 WebContentLayerClient::DisplayListConstructionDisabled); |
81 paintController.setSubsequenceCachingIsDisabled( | 81 paintController.setSubsequenceCachingIsDisabled( |
82 paintingControl == WebContentLayerClient::SubsequenceCachingDisabled); | 82 paintingControl == WebContentLayerClient::SubsequenceCachingDisabled); |
83 | 83 |
84 if (paintingControl == WebContentLayerClient::PartialInvalidation) | 84 if (paintingControl == WebContentLayerClient::PartialInvalidation) |
85 m_graphicsLayer->client()->invalidateTargetElementForTesting(); | 85 m_graphicsLayer->client()->invalidateTargetElementForTesting(); |
86 | 86 |
87 // We also disable caching when Painting or Construction are disabled. In both
cases we would like | 87 // We also disable caching when Painting or Construction are disabled. In both |
88 // to compare assuming the full cost of recording, not the cost of re-using ca
ched content. | 88 // cases we would like to compare assuming the full cost of recording, not the |
| 89 // cost of re-using cached content. |
89 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior && | 90 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior && |
90 paintingControl != WebContentLayerClient::PaintDefaultBehaviorForTest && | 91 paintingControl != WebContentLayerClient::PaintDefaultBehaviorForTest && |
91 paintingControl != WebContentLayerClient::SubsequenceCachingDisabled) | 92 paintingControl != WebContentLayerClient::SubsequenceCachingDisabled) |
92 paintController.invalidateAll(); | 93 paintController.invalidateAll(); |
93 | 94 |
94 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisabled; | 95 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisabled; |
95 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled || | 96 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled || |
96 paintingControl == WebContentLayerClient::DisplayListConstructionDisabled) | 97 paintingControl == WebContentLayerClient::DisplayListConstructionDisabled) |
97 disabledMode = GraphicsContext::FullyDisabled; | 98 disabledMode = GraphicsContext::FullyDisabled; |
98 | 99 |
99 // Anything other than PaintDefaultBehavior is for testing. In non-testing sce
narios, | 100 // Anything other than PaintDefaultBehavior is for testing. In non-testing |
100 // it is an error to call GraphicsLayer::paint. Actual painting occurs in Fram
eView::synchronizedPaint; | 101 // scenarios, it is an error to call GraphicsLayer::paint. Actual painting |
101 // this method merely copies the painted output to the WebDisplayItemList. | 102 // occurs in FrameView::synchronizedPaint; this method merely copies the |
| 103 // painted output to the WebDisplayItemList. |
102 if (paintingControl != PaintDefaultBehavior) | 104 if (paintingControl != PaintDefaultBehavior) |
103 m_graphicsLayer->paint(nullptr, disabledMode); | 105 m_graphicsLayer->paint(nullptr, disabledMode); |
104 | 106 |
105 paintArtifactToWebDisplayItemList( | 107 paintArtifactToWebDisplayItemList( |
106 webDisplayItemList, paintController.paintArtifact(), paintableRegion()); | 108 webDisplayItemList, paintController.paintArtifact(), paintableRegion()); |
107 | 109 |
108 paintController.setDisplayItemConstructionIsDisabled(false); | 110 paintController.setDisplayItemConstructionIsDisabled(false); |
109 paintController.setSubsequenceCachingIsDisabled(false); | 111 paintController.setSubsequenceCachingIsDisabled(false); |
110 } | 112 } |
111 | 113 |
112 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const { | 114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const { |
113 return m_graphicsLayer->getPaintController().approximateUnsharedMemoryUsage(); | 115 return m_graphicsLayer->getPaintController().approximateUnsharedMemoryUsage(); |
114 } | 116 } |
115 | 117 |
116 } // namespace blink | 118 } // namespace blink |
OLD | NEW |