In media, a lot of callbacks are only supposed to be run once, e.g. InitCB, DecodeCB, DecryptCB etc. We should convert them to use OnceCallback to make things easier to reason about.
Also, using OnceCallback would allow us to use ScopedCallbackRunner to have a clean solution making sure the callback will always run.
However, OnceCallback is a move-only type. Currently gmock doesn't support move-only types well so typically we have a workaround in the mock classes. We don't want to use this workaround extensively when we switch to use OnceCallback. So we should find a better solution (e.g. gmock supporting move-only types [1]) before we do massive migration.
Also, media::RunCallback [2] doesn't work with OnceCallback either. That needs to be fixed as well.
[1] https://github.com/google/googletest/issues/395
[2] https://cs.chromium.org/chromium/src/media/base/gmock_callback_support.h
Comment 1 by xhw...@chromium.org
, Aug 28 2017