Commit 1bb495b7 authored by Raymond Toy's avatar Raymond Toy Committed by Commit Bot

[Code Health] media/base conversion to BindOnce/Repeating

Change destroy_cb_ to be base::OnceClosure

Bug: 1007799
Change-Id: I86335290007d31af994d7ddf22c536645aea6595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1972934
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#725972}
parent 076c2a4a
...@@ -29,9 +29,9 @@ namespace media { ...@@ -29,9 +29,9 @@ namespace media {
// Local implementation of the TextTrack interface. // Local implementation of the TextTrack interface.
class FakeTextTrack : public TextTrack { class FakeTextTrack : public TextTrack {
public: public:
FakeTextTrack(const base::Closure& destroy_cb, const TextTrackConfig& config) FakeTextTrack(base::OnceClosure destroy_cb, const TextTrackConfig& config)
: destroy_cb_(destroy_cb), config_(config) {} : destroy_cb_(std::move(destroy_cb)), config_(config) {}
~FakeTextTrack() override { destroy_cb_.Run(); } ~FakeTextTrack() override { std::move(destroy_cb_).Run(); }
MOCK_METHOD5(addWebVTTCue, MOCK_METHOD5(addWebVTTCue,
void(base::TimeDelta start, void(base::TimeDelta start,
...@@ -40,7 +40,7 @@ class FakeTextTrack : public TextTrack { ...@@ -40,7 +40,7 @@ class FakeTextTrack : public TextTrack {
const std::string& content, const std::string& content,
const std::string& settings)); const std::string& settings));
const base::Closure destroy_cb_; base::OnceClosure destroy_cb_;
const TextTrackConfig config_; const TextTrackConfig config_;
private: private:
...@@ -88,13 +88,13 @@ class TextRendererTest : public testing::Test { ...@@ -88,13 +88,13 @@ class TextRendererTest : public testing::Test {
void OnAddTextTrack(const TextTrackConfig& config, void OnAddTextTrack(const TextTrackConfig& config,
AddTextTrackDoneCB done_cb) { AddTextTrackDoneCB done_cb) {
base::Closure destroy_cb = base::OnceClosure destroy_cb =
base::Bind(&TextRendererTest::OnDestroyTextTrack, base::BindOnce(&TextRendererTest::OnDestroyTextTrack,
base::Unretained(this), text_tracks_.size()); base::Unretained(this), text_tracks_.size());
// Text track objects are owned by the text renderer, but we cache them // Text track objects are owned by the text renderer, but we cache them
// here so we can inspect them. They get removed from our cache when the // here so we can inspect them. They get removed from our cache when the
// text renderer deallocates them. // text renderer deallocates them.
text_tracks_.push_back(new FakeTextTrack(destroy_cb, config)); text_tracks_.push_back(new FakeTextTrack(std::move(destroy_cb), config));
std::unique_ptr<TextTrack> text_track(text_tracks_.back()); std::unique_ptr<TextTrack> text_track(text_tracks_.back());
std::move(done_cb).Run(std::move(text_track)); std::move(done_cb).Run(std::move(text_track));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment