| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 LayerTreeSettings::LayerTreeSettings() | 97 LayerTreeSettings::LayerTreeSettings() |
| 98 : acceleratePainting(false) | 98 : acceleratePainting(false) |
| 99 , implSidePainting(false) | 99 , implSidePainting(false) |
| 100 , renderVSyncEnabled(true) | 100 , renderVSyncEnabled(true) |
| 101 , perTilePaintingEnabled(false) | 101 , perTilePaintingEnabled(false) |
| 102 , partialSwapEnabled(false) | 102 , partialSwapEnabled(false) |
| 103 , acceleratedAnimationEnabled(true) | 103 , acceleratedAnimationEnabled(true) |
| 104 , pageScalePinchZoomEnabled(false) | 104 , pageScalePinchZoomEnabled(false) |
| 105 , backgroundColorInsteadOfCheckerboard(false) | 105 , backgroundColorInsteadOfCheckerboard(false) |
| 106 , showOverdrawInTracing(false) | 106 , showOverdrawInTracing(false) |
| 107 , canUseLCDText(true) |
| 107 , refreshRate(0) | 108 , refreshRate(0) |
| 108 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 109 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
| 109 , numRasterThreads(1) | 110 , numRasterThreads(1) |
| 110 , defaultTileSize(gfx::Size(256, 256)) | 111 , defaultTileSize(gfx::Size(256, 256)) |
| 111 , maxUntiledLayerSize(gfx::Size(512, 512)) | 112 , maxUntiledLayerSize(gfx::Size(512, 512)) |
| 112 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | 113 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
| 113 { | 114 { |
| 114 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | 115 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. |
| 115 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | 116 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); |
| 116 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | 117 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); |
| 117 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | 118 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); |
| 118 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | 119 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); |
| 119 | 120 |
| 121 // TODO(alokp): Remove this hard-coded setting. |
| 122 // Platforms that need to disable LCD text must explicitly set this value. |
| 123 #if defined(OS_ANDROID) |
| 124 canUseLCDText = false; |
| 125 #endif |
| 126 |
| 120 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | 127 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); |
| 121 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | 128 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); |
| 122 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | 129 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); |
| 123 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | 130 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
| 124 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | 131 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); |
| 125 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | 132 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); |
| 126 | 133 |
| 127 if (CommandLine::ForCurrentProcess()->HasSwitch( | 134 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 128 switches::kNumRasterThreads)) { | 135 switches::kNumRasterThreads)) { |
| 129 const size_t kMaxRasterThreads = 64; | 136 const size_t kMaxRasterThreads = 64; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 LayerList updateList; | 682 LayerList updateList; |
| 676 | 683 |
| 677 { | 684 { |
| 678 if (m_settings.pageScalePinchZoomEnabled) { | 685 if (m_settings.pageScalePinchZoomEnabled) { |
| 679 Layer* rootScroll = findFirstScrollableLayer(rootLayer); | 686 Layer* rootScroll = findFirstScrollableLayer(rootLayer); |
| 680 if (rootScroll) | 687 if (rootScroll) |
| 681 rootScroll->setImplTransform(m_implTransform); | 688 rootScroll->setImplTransform(m_implTransform); |
| 682 } | 689 } |
| 683 | 690 |
| 684 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); | 691 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); |
| 685 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, updateList); | 692 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, m_settings.canUseLCDText, updateList); |
| 686 } | 693 } |
| 687 | 694 |
| 688 // Reset partial texture update requests. | 695 // Reset partial texture update requests. |
| 689 m_partialTextureUpdateRequests = 0; | 696 m_partialTextureUpdateRequests = 0; |
| 690 | 697 |
| 691 bool needMoreUpdates = paintLayerContents(updateList, queue); | 698 bool needMoreUpdates = paintLayerContents(updateList, queue); |
| 692 if (m_triggerIdleUpdates && needMoreUpdates) { | 699 if (m_triggerIdleUpdates && needMoreUpdates) { |
| 693 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; | 700 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; |
| 694 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); | 701 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); |
| 695 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); | 702 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 else | 982 else |
| 976 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 983 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 977 } | 984 } |
| 978 } | 985 } |
| 979 | 986 |
| 980 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 987 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 981 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 988 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 982 } | 989 } |
| 983 | 990 |
| 984 } // namespace cc | 991 } // namespace cc |
| OLD | NEW |