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 "content/browser/media/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 void BrowserMediaPlayerManager::ReleaseResources(int player_id) { | 459 void BrowserMediaPlayerManager::ReleaseResources(int player_id) { |
460 MediaPlayerAndroid* player = GetPlayer(player_id); | 460 MediaPlayerAndroid* player = GetPlayer(player_id); |
461 if (player) | 461 if (player) |
462 ReleasePlayer(player); | 462 ReleasePlayer(player); |
463 if (player_id == fullscreen_player_id_) | 463 if (player_id == fullscreen_player_id_) |
464 fullscreen_player_is_released_ = true; | 464 fullscreen_player_is_released_ = true; |
465 } | 465 } |
466 | 466 |
467 std::unique_ptr<MediaPlayerAndroid> BrowserMediaPlayerManager::SwapPlayer( | 467 std::unique_ptr<MediaPlayerAndroid> BrowserMediaPlayerManager::SwapPlayer( |
468 int player_id, | 468 int player_id, |
469 MediaPlayerAndroid* player) { | 469 std::unique_ptr<MediaPlayerAndroid> player) { |
470 std::unique_ptr<MediaPlayerAndroid> previous_player; | 470 std::unique_ptr<MediaPlayerAndroid> previous_player; |
471 for (auto it = players_.begin(); it != players_.end(); ++it) { | 471 for (auto it = players_.begin(); it != players_.end(); ++it) { |
472 if ((*it)->player_id() == player_id) { | 472 if ((*it)->player_id() == player_id) { |
473 previous_player = std::move(*it); | 473 previous_player = std::move(*it); |
474 MediaWebContentsObserverAndroid::FromWebContents(web_contents_) | 474 MediaWebContentsObserverAndroid::FromWebContents(web_contents_) |
475 ->DisconnectMediaSession(render_frame_host_, | 475 ->DisconnectMediaSession(render_frame_host_, |
476 player_id_to_delegate_id_map_[player_id]); | 476 player_id_to_delegate_id_map_[player_id]); |
477 players_.erase(it); | 477 players_.erase(it); |
478 players_.push_back(base::WrapUnique(player)); | 478 players_.push_back(std::move(player)); |
479 break; | 479 break; |
480 } | 480 } |
481 } | 481 } |
482 return previous_player; | 482 return previous_player; |
483 } | 483 } |
484 | 484 |
485 bool BrowserMediaPlayerManager::RequestDecoderResources( | 485 bool BrowserMediaPlayerManager::RequestDecoderResources( |
486 int player_id, bool temporary) { | 486 int player_id, bool temporary) { |
487 if (!MediaThrottler::GetInstance()->RequestDecoderResources()) | 487 if (!MediaThrottler::GetInstance()->RequestDecoderResources()) |
488 return false; | 488 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 if (!player) | 559 if (!player) |
560 return; | 560 return; |
561 player->Start(); | 561 player->Start(); |
562 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 562 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
563 video_view_->OpenVideo(); | 563 video_view_->OpenVideo(); |
564 fullscreen_player_is_released_ = false; | 564 fullscreen_player_is_released_ = false; |
565 } | 565 } |
566 } | 566 } |
567 | 567 |
568 } // namespace content | 568 } // namespace content |
OLD | NEW |