| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "platform/graphics/ContentLayerDelegate.h" | 27 #include "platform/graphics/ContentLayerDelegate.h" |
| 28 | 28 |
| 29 #include "platform/EventTracer.h" | 29 #include "platform/EventTracer.h" |
| 30 #include "platform/RuntimeEnabledFeatures.h" | 30 #include "platform/RuntimeEnabledFeatures.h" |
| 31 #include "platform/TraceEvent.h" | 31 #include "platform/TraceEvent.h" |
| 32 #include "platform/TracedValue.h" | 32 #include "platform/TracedValue.h" |
| 33 #include "platform/geometry/IntRect.h" | 33 #include "platform/geometry/IntRect.h" |
| 34 #include "platform/graphics/GraphicsContext.h" | 34 #include "platform/graphics/GraphicsContext.h" |
| 35 #include "platform/graphics/paint/DisplayItemList.h" | 35 #include "platform/graphics/paint/DisplayItemList.h" |
| 36 #include "platform/graphics/paint/DisplayList.h" |
| 36 #include "platform/transforms/AffineTransform.h" | 37 #include "platform/transforms/AffineTransform.h" |
| 37 #include "platform/transforms/TransformationMatrix.h" | 38 #include "platform/transforms/TransformationMatrix.h" |
| 38 #include "public/platform/WebDisplayItemList.h" | 39 #include "public/platform/WebDisplayItemList.h" |
| 39 #include "public/platform/WebFloatRect.h" | 40 #include "public/platform/WebFloatRect.h" |
| 40 #include "public/platform/WebRect.h" | 41 #include "public/platform/WebRect.h" |
| 41 #include "third_party/skia/include/core/SkCanvas.h" | 42 #include "third_party/skia/include/core/SkCanvas.h" |
| 42 #include "third_party/skia/include/core/SkPicture.h" | 43 #include "third_party/skia/include/core/SkPicture.h" |
| 43 #include "third_party/skia/include/core/SkPictureRecorder.h" | 44 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 void ContentLayerDelegate::paintContents( | 86 void ContentLayerDelegate::paintContents( |
| 86 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 87 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
| 87 WebContentLayerClient::PaintingControlSetting paintingControl) | 88 WebContentLayerClient::PaintingControlSetting paintingControl) |
| 88 { | 89 { |
| 89 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 90 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
| 90 | 91 |
| 91 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 92 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 92 | 93 |
| 94 if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) { |
| 95 // Scrollbars for the root frame stil paint in the old way, and don't ha
ve a displayList(). |
| 96 if (m_painter->displayList()) { |
| 97 for (unsigned i = 0; i < m_painter->displayList()->size(); i++) { |
| 98 m_painter->displayList()->displayItemInternal(i).appendToWebDisp
layItemList(webDisplayItemList); |
| 99 } |
| 100 return; |
| 101 } |
| 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 |
| 130 const WebDisplayList* ContentLayerDelegate::displayList() const |
| 131 { |
| 132 return m_painter->displayList(); |
| 133 } |
| 134 |
| 135 const WebDisplayItemTransformTree* ContentLayerDelegate::transformTree() const |
| 136 { |
| 137 return 0; |
| 138 } |
| 139 |
| 119 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |