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 14 matching lines...) Expand all Loading... |
25 #include "config.h" | 25 #include "config.h" |
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/PaintController.h" |
36 #include "platform/transforms/AffineTransform.h" | 36 #include "platform/transforms/AffineTransform.h" |
37 #include "platform/transforms/TransformationMatrix.h" | 37 #include "platform/transforms/TransformationMatrix.h" |
38 #include "public/platform/WebDisplayItemList.h" | 38 #include "public/platform/WebDisplayItemList.h" |
39 #include "public/platform/WebFloatRect.h" | 39 #include "public/platform/WebFloatRect.h" |
40 #include "public/platform/WebRect.h" | 40 #include "public/platform/WebRect.h" |
41 #include "third_party/skia/include/core/SkCanvas.h" | 41 #include "third_party/skia/include/core/SkCanvas.h" |
42 #include "third_party/skia/include/core/SkPicture.h" | 42 #include "third_party/skia/include/core/SkPicture.h" |
43 #include "third_party/skia/include/core/SkPictureRecorder.h" | 43 #include "third_party/skia/include/core/SkPictureRecorder.h" |
44 | 44 |
45 namespace blink { | 45 namespace blink { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void ContentLayerDelegate::paintContents( | 78 void ContentLayerDelegate::paintContents( |
79 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 79 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
80 WebContentLayerClient::PaintingControlSetting paintingControl) | 80 WebContentLayerClient::PaintingControlSetting paintingControl) |
81 { | 81 { |
82 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 82 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
83 | 83 |
84 // TODO(pdr): Remove when slimming paint v2 is further along. This is only | 84 // TODO(pdr): Remove when slimming paint v2 is further along. This is only |
85 // here so the browser is usable during development and does not crash due | 85 // here so the browser is usable during development and does not crash due |
86 // to committing the new display items twice. | 86 // to committing the new display items twice. |
87 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 87 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
88 m_painter->displayItemList()->paintArtifact().appendToWebDisplayItemList
(webDisplayItemList); | 88 m_painter->paintController()->paintArtifact().appendToWebDisplayItemList
(webDisplayItemList); |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 DisplayItemList* displayItemList = m_painter->displayItemList(); | 92 PaintController* paintController = m_painter->paintController(); |
93 ASSERT(displayItemList); | 93 ASSERT(paintController); |
94 displayItemList->setDisplayItemConstructionIsDisabled( | 94 paintController->setDisplayItemConstructionIsDisabled( |
95 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); | 95 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); |
96 | 96 |
97 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like | 97 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like |
98 // to compare assuming the full cost of recording, not the cost of re-using
cached content. | 98 // to compare assuming the full cost of recording, not the cost of re-using
cached content. |
99 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) | 99 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) |
100 displayItemList->invalidateAll(); | 100 paintController->invalidateAll(); |
101 | 101 |
102 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; | 102 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; |
103 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled | 103 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled |
104 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) | 104 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) |
105 disabledMode = GraphicsContext::FullyDisabled; | 105 disabledMode = GraphicsContext::FullyDisabled; |
106 GraphicsContext context(displayItemList, disabledMode); | 106 GraphicsContext context(paintController, disabledMode); |
107 | 107 |
108 m_painter->paint(context, clip); | 108 m_painter->paint(context, clip); |
109 | 109 |
110 displayItemList->commitNewDisplayItems(); | 110 paintController->commitNewDisplayItems(); |
111 displayItemList->paintArtifact().appendToWebDisplayItemList(webDisplayItemLi
st); | 111 paintController->paintArtifact().appendToWebDisplayItemList(webDisplayItemLi
st); |
112 } | 112 } |
113 | 113 |
114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
115 { | 115 { |
116 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); | 116 return m_painter->paintController()->approximateUnsharedMemoryUsage(); |
117 } | 117 } |
118 | 118 |
119 } // namespace blink | 119 } // namespace blink |
OLD | NEW |