Refactor budget computation to be more tuneable.

Previously, the budget computation used a single master value,
kBudgetDurationInHours to control both how long awards were valid and
also indirectly, how much budget an origin received per hour. The fixed
value in the system was that an origin received SES_score budget per
kBudgetDurationInHours hours.

The side effect of this indirect effect is that if chromium wants
for awards to last shorter periods of time, then the origin will get
larger grants of budget. So modifying the duration increases the amount
of work the origin can do, which is usually unintended.

A previous CL did exactly that, decreasing the duration and unintentionally
increasing the amount of work that can be done.

This CL modifies the calculation to use two values. The duration is still
there and is used to determine how much budget the origin has been granted
recently and how long new grants should last. A new value provides a target
budget for a maximally engaged origin, is used to provide a fixed upper
limit for budget granted to the origin. Finally, this CL reverses the earlier
unintentional increase in daily budget. Before this patch, full engagement
origins received 100 budget per 4 days, now they receive 48 per 4 days.

Tests were also updated to use the new computation.

BUG=617971

Review-Url: https://codereview.chromium.org/2620393002
Cr-Commit-Position: refs/heads/master@{#443874}
7 files changed