Don't track locks unless likely to block.

Chrome has a huge number of locks that are constantly acquired and
released.  Most acquisitions don't block and so having them "tracked"
by the ActivityTracker tends to be expensive with no possible benefit.

If tracking is enabled, simply "try" the lock first and skip the
(tracked) blocking call completely.

This fixes problems where some run-times were 9x longer than when
tracking is not enabled.

Bug: 777409
Change-Id: Ic132d50db094a7bfe25677fd35157d4473a106cd
Reviewed-on: https://chromium-review.googlesource.com/737858
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Sigurður Ásgeirsson <siggi@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511599}

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