Fix usage of MemoryPressureMonitor from non-UI thread.

MemoryPressureMonitor is supposed to be called only from UI thread
(as defined by ThreadUtils), but was called from a binder thread by
ChildProcessService$1.onMemoryPressure (see the bug).

The issue was introduced because MemoryPressureMonitor.notifyPressure()
is an exception from MemoryPressureMonitor "UI thread only" rule, and
can be called from any thread. When onMemoryPressure() was initially
added, it had just a single notifyPressure() call, so no posting to UI
thread was necessary. Later getLastReportedPressure() call was added,
but issue with calling it on non-UI thread was overlooked.

This CL fixes the original issue, and also removes notifyPressure()
special case, avoiding similar threading mistakes in the future.

Bug: 834099
Change-Id: Idc5cc478eac217f2c49d642187677e9bf7a5309f
Reviewed-on: https://chromium-review.googlesource.com/1016095
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Dmitry Skiba <dskiba@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551760}

CrOS-Libchrome-Original-Commit: 75d33ec672525f32725f668c848e7f98c1503d1e
3 files changed
tree: d979209000b104ac2b6e0cbc4801752976808335
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/