DRP implements FlushMetricsOnAppEnterBackground and invokes both RecordPageSizeUMA(); and SendPingback(timing, info); from this method.
If FlushMetricsOnAppEnterBackground gets invoked before commit, we may log metrics for a non-DRP page, since DRP filtering policy is applied in OnCommit.
SendPingback checks to make sure browser_context_ is not null, which protects it from this issue since browser_context_ is only set in OnCommit.
RecordPageSizeUMA is protected by a test for num_network_requests_ == 0, which similarly can never be true before commit.
We should update the logging logic to be more explicit about this, since a bug could easily slip in.
Comment 1 by bugdroid1@chromium.org
, Feb 13 2017