OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/blink/texttrack_impl.h" | 5 #include "media/blink/texttrack_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
10 #include "media/base/bind_to_current_loop.h" | 12 #include "media/base/bind_to_current_loop.h" |
11 #include "media/blink/webinbandtexttrack_impl.h" | 13 #include "media/blink/webinbandtexttrack_impl.h" |
12 #include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h" | 14 #include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h" |
13 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 15 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
14 | 16 |
15 namespace media { | 17 namespace media { |
16 | 18 |
17 TextTrackImpl::TextTrackImpl( | 19 TextTrackImpl::TextTrackImpl( |
18 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
19 blink::WebMediaPlayerClient* client, | 21 blink::WebMediaPlayerClient* client, |
20 scoped_ptr<WebInbandTextTrackImpl> text_track) | 22 scoped_ptr<WebInbandTextTrackImpl> text_track) |
21 : task_runner_(task_runner), | 23 : task_runner_(task_runner), |
22 client_(client), | 24 client_(client), |
23 text_track_(text_track.Pass()) { | 25 text_track_(std::move(text_track)) { |
24 client_->addTextTrack(text_track_.get()); | 26 client_->addTextTrack(text_track_.get()); |
25 } | 27 } |
26 | 28 |
27 TextTrackImpl::~TextTrackImpl() { | 29 TextTrackImpl::~TextTrackImpl() { |
28 task_runner_->PostTask( | 30 task_runner_->PostTask( |
29 FROM_HERE, | 31 FROM_HERE, |
30 base::Bind(&TextTrackImpl::OnRemoveTrack, | 32 base::Bind(&TextTrackImpl::OnRemoveTrack, |
31 client_, | 33 client_, |
32 base::Passed(&text_track_))); | 34 base::Passed(&text_track_))); |
33 } | 35 } |
(...skipping 27 matching lines...) Expand all Loading... |
61 } | 63 } |
62 | 64 |
63 void TextTrackImpl::OnRemoveTrack( | 65 void TextTrackImpl::OnRemoveTrack( |
64 blink::WebMediaPlayerClient* client, | 66 blink::WebMediaPlayerClient* client, |
65 scoped_ptr<WebInbandTextTrackImpl> text_track) { | 67 scoped_ptr<WebInbandTextTrackImpl> text_track) { |
66 if (text_track->client()) | 68 if (text_track->client()) |
67 client->removeTextTrack(text_track.get()); | 69 client->removeTextTrack(text_track.get()); |
68 } | 70 } |
69 | 71 |
70 } // namespace media | 72 } // namespace media |
OLD | NEW |