OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "core/rendering/compositing/CompositingRequirementsUpdater.h" | 50 #include "core/rendering/compositing/CompositingRequirementsUpdater.h" |
51 #include "core/rendering/compositing/GraphicsLayerTreeBuilder.h" | 51 #include "core/rendering/compositing/GraphicsLayerTreeBuilder.h" |
52 #include "core/rendering/compositing/GraphicsLayerUpdater.h" | 52 #include "core/rendering/compositing/GraphicsLayerUpdater.h" |
53 #include "platform/OverscrollTheme.h" | 53 #include "platform/OverscrollTheme.h" |
54 #include "platform/TraceEvent.h" | 54 #include "platform/TraceEvent.h" |
55 #include "platform/graphics/GraphicsLayer.h" | 55 #include "platform/graphics/GraphicsLayer.h" |
56 #include "public/platform/Platform.h" | 56 #include "public/platform/Platform.h" |
57 | 57 |
58 namespace WebCore { | 58 namespace WebCore { |
59 | 59 |
60 class DeprecatedDirtyCompositingDuringCompositingUpdate { | |
61 WTF_MAKE_NONCOPYABLE(DeprecatedDirtyCompositingDuringCompositingUpdate); | |
62 public: | |
63 DeprecatedDirtyCompositingDuringCompositingUpdate(DocumentLifecycle& lifecyc le) | |
64 : m_lifecycle(lifecycle) | |
65 , m_deprecatedTransition(lifecycle.state(), DocumentLifecycle::LayoutCle an) | |
66 , m_originalState(lifecycle.state()) | |
67 { | |
68 } | |
69 | |
70 ~DeprecatedDirtyCompositingDuringCompositingUpdate() | |
71 { | |
72 if (m_originalState != DocumentLifecycle::InCompositingUpdate) | |
73 return; | |
74 if (m_lifecycle.state() != m_originalState) { | |
75 // FIXME: It's crazy that we can trigger a style recalc from inside | |
76 // the compositing update, but that happens in compositing/visibilit y/hidden-iframe.html. | |
77 ASSERT(m_lifecycle.state() == DocumentLifecycle::LayoutClean || m_li fecycle.state() == DocumentLifecycle::VisualUpdatePending); | |
78 m_lifecycle.advanceTo(m_originalState); | |
79 } | |
80 } | |
81 | |
82 private: | |
83 DocumentLifecycle& m_lifecycle; | |
84 DocumentLifecycle::DeprecatedTransition m_deprecatedTransition; | |
85 DocumentLifecycle::State m_originalState; | |
86 }; | |
87 | |
88 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) | 60 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
89 : m_renderView(renderView) | 61 : m_renderView(renderView) |
90 , m_compositingReasonFinder(renderView) | 62 , m_compositingReasonFinder(renderView) |
91 , m_pendingUpdateType(CompositingUpdateNone) | 63 , m_pendingUpdateType(CompositingUpdateNone) |
92 , m_hasAcceleratedCompositing(true) | 64 , m_hasAcceleratedCompositing(true) |
93 , m_compositing(false) | 65 , m_compositing(false) |
94 , m_rootShouldAlwaysCompositeDirty(true) | 66 , m_rootShouldAlwaysCompositeDirty(true) |
95 , m_needsUpdateFixedBackground(false) | 67 , m_needsUpdateFixedBackground(false) |
96 , m_isTrackingRepaints(false) | 68 , m_isTrackingRepaints(false) |
97 , m_rootLayerAttachment(RootLayerUnattached) | 69 , m_rootLayerAttachment(RootLayerUnattached) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 if (child->isLocalFrame()) | 182 if (child->isLocalFrame()) |
211 toLocalFrame(child)->contentRenderer()->compositor()->updateIfNeeded Recursive(); | 183 toLocalFrame(child)->contentRenderer()->compositor()->updateIfNeeded Recursive(); |
212 } | 184 } |
213 | 185 |
214 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateIfNeededRecurs ive"); | 186 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateIfNeededRecurs ive"); |
215 | 187 |
216 ASSERT(!m_renderView.needsLayout()); | 188 ASSERT(!m_renderView.needsLayout()); |
217 | 189 |
218 ScriptForbiddenScope forbidScript; | 190 ScriptForbiddenScope forbidScript; |
219 | 191 |
192 // FIXME: enableCompositingModeIfNeeded can trigger a CompositingUpdateRebui ldTree, | |
193 // which asserts that it's not InCompositingUpdate. | |
194 enableCompositingModeIfNeeded(); | |
ojan
2014/06/11 18:44:47
Incidentally, if we were to continue to invest in
| |
195 | |
220 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); | 196 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); |
221 | |
222 updateIfNeeded(); | 197 updateIfNeeded(); |
223 | |
224 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); | 198 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); |
225 | 199 |
226 DocumentAnimations::startPendingAnimations(m_renderView.document()); | 200 DocumentAnimations::startPendingAnimations(m_renderView.document()); |
227 // TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507 | 201 // TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507 |
228 // ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean); | 202 // ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean); |
229 | 203 |
230 #if ASSERT_ENABLED | 204 #if ASSERT_ENABLED |
231 assertNoUnresolvedDirtyBits(); | 205 assertNoUnresolvedDirtyBits(); |
232 for (Frame* child = m_renderView.frameView()->frame().tree().firstChild(); c hild; child = child->tree().nextSibling()) { | 206 for (Frame* child = m_renderView.frameView()->frame().tree().firstChild(); c hild; child = child->tree().nextSibling()) { |
233 if (child->isLocalFrame()) | 207 if (child->isLocalFrame()) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 return; | 281 return; |
308 | 282 |
309 m_rootContentLayer->removeAllChildren(); | 283 m_rootContentLayer->removeAllChildren(); |
310 m_overflowControlsHostLayer->addChild(videoLayer); | 284 m_overflowControlsHostLayer->addChild(videoLayer); |
311 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) | 285 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) |
312 backgroundLayer->removeFromParent(); | 286 backgroundLayer->removeFromParent(); |
313 } | 287 } |
314 | 288 |
315 void RenderLayerCompositor::updateIfNeeded() | 289 void RenderLayerCompositor::updateIfNeeded() |
316 { | 290 { |
317 { | |
318 // FIXME: Notice that we call this function before checking the dirty bi ts below. | |
319 // We'll need to remove DeprecatedDirtyCompositingDuringCompositingUpdat e | |
320 // before moving this function after checking the dirty bits. | |
321 DeprecatedDirtyCompositingDuringCompositingUpdate marker(lifecycle()); | |
322 | |
323 // FIXME: enableCompositingModeIfNeeded can trigger a CompositingUpdateR ebuildTree, | |
324 // which asserts that it's not InCompositingUpdate. | |
325 enableCompositingModeIfNeeded(); | |
326 } | |
327 | |
328 CompositingUpdateType updateType = m_pendingUpdateType; | 291 CompositingUpdateType updateType = m_pendingUpdateType; |
329 m_pendingUpdateType = CompositingUpdateNone; | 292 m_pendingUpdateType = CompositingUpdateNone; |
330 | 293 |
331 if (!hasAcceleratedCompositing()) | 294 if (!hasAcceleratedCompositing()) |
332 return; | 295 return; |
333 | 296 |
334 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() && scrolling Coordinator()->needsToUpdateAfterCompositingChange(); | 297 bool needsToUpdateScrollingCoordinator = scrollingCoordinator() && scrolling Coordinator()->needsToUpdateAfterCompositingChange(); |
335 if (updateType == CompositingUpdateNone && !needsToUpdateScrollingCoordinato r) | 298 if (updateType == CompositingUpdateNone && !needsToUpdateScrollingCoordinato r) |
336 return; | 299 return; |
337 | 300 |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1295 } else if (graphicsLayer == m_scrollLayer.get()) { | 1258 } else if (graphicsLayer == m_scrollLayer.get()) { |
1296 name = "LocalFrame Scrolling Layer"; | 1259 name = "LocalFrame Scrolling Layer"; |
1297 } else { | 1260 } else { |
1298 ASSERT_NOT_REACHED(); | 1261 ASSERT_NOT_REACHED(); |
1299 } | 1262 } |
1300 | 1263 |
1301 return name; | 1264 return name; |
1302 } | 1265 } |
1303 | 1266 |
1304 } // namespace WebCore | 1267 } // namespace WebCore |
OLD | NEW |