summaryrefslogtreecommitdiffstats
path: root/base/time/time.h
diff options
context:
space:
mode:
authormichaeln <michaeln@chromium.org>2015-02-20 14:22:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 22:23:26 +0000
commit770daec923bb61392afbf9ca16ee0dad147e154f (patch)
tree583692ea0389f4b05d08f8c22a1a9c855aedf4a6 /base/time/time.h
parentcaa8fc58bce415a672cbda87115645abeb543cbd (diff)
downloadchromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.zip
chromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.tar.gz
chromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.tar.bz2
[DOMStorage] Rate limiting writes to disk.
Given access patterns that are just wrong, local & session storage can write many gigabytes per day or keep the disk perpetually spun up. To avoid excessive IO, we apply limits to the amount of data being written and the frequency of writes to address both kinds of 'bad' behaviors. TBR=rvargas BUG=176727 Review URL: https://codereview.chromium.org/896643002 Cr-Commit-Position: refs/heads/master@{#317424}
Diffstat (limited to 'base/time/time.h')
-rw-r--r--base/time/time.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/time/time.h b/base/time/time.h
index 18de085..6d61861 100644
--- a/base/time/time.h
+++ b/base/time/time.h
@@ -178,6 +178,14 @@ class BASE_EXPORT TimeDelta {
return delta_ / a.delta_;
}
+ // Multiplicative computations with floats.
+ TimeDelta multiply_by(double a) const {
+ return TimeDelta(delta_ * a);
+ }
+ TimeDelta divide_by(double a) const {
+ return TimeDelta(delta_ / a);
+ }
+
// Defined below because it depends on the definition of the other classes.
Time operator+(Time t) const;
TimeTicks operator+(TimeTicks t) const;