Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: content/browser/media/media_web_contents_observer.cc

Issue 2759713002: Media: replace HasActiveEffectivelyFullscreenVideo DCHECK with early return. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/media_web_contents_observer.h" 5 #include "content/browser/media/media_web_contents_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/media/audible_metrics.h" 10 #include "content/browser/media/audible_metrics.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 CreateAudioPowerSaveBlocker(); 55 CreateAudioPowerSaveBlocker();
56 } else { 56 } else {
57 audio_power_save_blocker_.reset(); 57 audio_power_save_blocker_.reset();
58 } 58 }
59 59
60 GetAudibleMetrics()->UpdateAudibleWebContentsState( 60 GetAudibleMetrics()->UpdateAudibleWebContentsState(
61 web_contents(), audio_stream_monitor->IsCurrentlyAudible()); 61 web_contents(), audio_stream_monitor->IsCurrentlyAudible());
62 } 62 }
63 63
64 bool MediaWebContentsObserver::HasActiveEffectivelyFullscreenVideo() const { 64 bool MediaWebContentsObserver::HasActiveEffectivelyFullscreenVideo() const {
65 DCHECK(web_contents()->IsFullscreen()); 65 if (!web_contents()->IsFullscreen() || !fullscreen_player_)
66
67 if (!fullscreen_player_)
68 return false; 66 return false;
69 67
70 // Check that the player is active. 68 // Check that the player is active.
71 const auto& players = active_video_players_.find(fullscreen_player_->first); 69 const auto& players = active_video_players_.find(fullscreen_player_->first);
72 if (players == active_video_players_.end()) 70 if (players == active_video_players_.end())
73 return false; 71 return false;
74 if (players->second.find(fullscreen_player_->second) == players->second.end()) 72 if (players->second.find(fullscreen_player_->second) == players->second.end())
75 return false; 73 return false;
76 74
77 return true; 75 return true;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 if (it == player_map->end()) 285 if (it == player_map->end())
288 return; 286 return;
289 287
290 for (int delegate_id : it->second) 288 for (int delegate_id : it->second)
291 removed_players->insert(MediaPlayerId(render_frame_host, delegate_id)); 289 removed_players->insert(MediaPlayerId(render_frame_host, delegate_id));
292 290
293 player_map->erase(it); 291 player_map->erase(it);
294 } 292 }
295 293
296 } // namespace content 294 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698