Chromium Code Reviews| Index: cc/resources/tile_priority.cc |
| diff --git a/cc/resources/tile_priority.cc b/cc/resources/tile_priority.cc |
| index 1523eefc431f2c6adbea1183a21f26eda052916f..81f3532ccf0d02532588237be08482c1170ab737 100644 |
| --- a/cc/resources/tile_priority.cc |
| +++ b/cc/resources/tile_priority.cc |
| @@ -85,55 +85,30 @@ scoped_ptr<base::Value> TileResolutionAsValue( |
| "<unknown TileResolution value>")); |
| } |
| +scoped_ptr<base::Value> TilePriorityBinAsValue(TilePriority::PriorityBin bin) { |
| + switch (bin) { |
| + case TilePriority::NOW: |
| + return scoped_ptr<base::Value>(base::Value::CreateStringValue("NOW")); |
| + case TilePriority::SOON: |
| + return scoped_ptr<base::Value>(base::Value::CreateStringValue("SOON")); |
| + case TilePriority::EVENTUALLY: |
| + return scoped_ptr<base::Value>( |
| + base::Value::CreateStringValue("EVENTUALLY")); |
| + } |
| + DCHECK(false) << "Unrecognized TilePriority::PriorityBin value " << bin; |
| + return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
| + "<unknown TilePriority::PriorityBin value>")); |
| +} |
| + |
| scoped_ptr<base::Value> TilePriority::AsValue() const { |
| scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| state->Set("resolution", TileResolutionAsValue(resolution).release()); |
| - state->Set("time_to_visible_in_seconds", |
| - MathUtil::AsValueSafely(time_to_visible_in_seconds).release()); |
| - state->Set("distance_to_visible_in_pixels", |
| - MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); |
| + state->Set("priority_bin", TilePriorityBinAsValue(priority_bin).release()); |
|
vmpstr
2014/01/31 20:53:38
This will also require some traceviewer changes...
enne (OOO)
2014/01/31 23:07:46
Do you know if TraceViewer will break in the short
vmpstr
2014/02/03 20:27:24
A bit of both. It will "break" in the sense that s
|
| + state->Set("distance_to_visible", |
| + MathUtil::AsValueSafely(distance_to_visible).release()); |
| return state.PassAs<base::Value>(); |
| } |
| -float TilePriority::TimeForBoundsToIntersect(const gfx::RectF& previous_bounds, |
| - const gfx::RectF& current_bounds, |
| - float time_delta, |
| - const gfx::RectF& target_bounds) { |
| - // Perform an intersection test explicitly between current and target. |
| - if (current_bounds.x() < target_bounds.right() && |
| - current_bounds.y() < target_bounds.bottom() && |
| - target_bounds.x() < current_bounds.right() && |
| - target_bounds.y() < current_bounds.bottom()) |
| - return 0.0f; |
| - |
| - const float kMaxTimeToVisibleInSeconds = |
| - std::numeric_limits<float>::infinity(); |
| - |
| - if (time_delta == 0.0f) |
| - return kMaxTimeToVisibleInSeconds; |
| - |
| - // As we are trying to solve the case of both scaling and scrolling, using |
| - // a single coordinate with velocity is not enough. The logic here is to |
| - // calculate the velocity for each edge. Then we calculate the time range that |
| - // each edge will stay on the same side of the target bounds. If there is an |
| - // overlap between these time ranges, the bounds must have intersect with |
| - // each other during that period of time. |
| - Range range(0.0f, kMaxTimeToVisibleInSeconds); |
| - IntersectPositiveHalfplane( |
| - &range, previous_bounds.x(), current_bounds.x(), |
| - target_bounds.right(), time_delta); |
| - IntersectNegativeHalfplane( |
| - &range, previous_bounds.right(), current_bounds.right(), |
| - target_bounds.x(), time_delta); |
| - IntersectPositiveHalfplane( |
| - &range, previous_bounds.y(), current_bounds.y(), |
| - target_bounds.bottom(), time_delta); |
| - IntersectNegativeHalfplane( |
| - &range, previous_bounds.bottom(), current_bounds.bottom(), |
| - target_bounds.y(), time_delta); |
| - return range.IsEmpty() ? kMaxTimeToVisibleInSeconds : range.start_; |
| -} |
| - |
| scoped_ptr<base::Value> TileMemoryLimitPolicyAsValue( |
| TileMemoryLimitPolicy policy) { |
| switch (policy) { |