Added ScopedCallback functions for early execution or cancellation.

Change-Id: I6493cfa81d778c47aa7283dc3196989384235f0a
Merge "Added ScopedCallback functions for early execution or cancellation."