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

Side by Side Diff: content/browser/media/session/media_session_impl.cc

Issue 2833493002: [Media>UI] Apply throttling if the notification is updated too frequently (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/session/media_session_impl.h" 5 #include "content/browser/media/session/media_session_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "content/browser/media/session/audio_focus_delegate.h" 8 #include "content/browser/media/session/audio_focus_delegate.h"
9 #include "content/browser/media/session/media_session_controller.h" 9 #include "content/browser/media/session/media_session_controller.h"
10 #include "content/browser/media/session/media_session_player_observer.h" 10 #include "content/browser/media/session/media_session_player_observer.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 RemovePlayer(observer, player_id); 324 RemovePlayer(observer, player_id);
325 return; 325 return;
326 } 326 }
327 327
328 // Otherwise, suspend the session. 328 // Otherwise, suspend the session.
329 DCHECK(IsActive()); 329 DCHECK(IsActive());
330 OnSuspendInternal(SuspendType::CONTENT, State::SUSPENDED); 330 OnSuspendInternal(SuspendType::CONTENT, State::SUSPENDED);
331 } 331 }
332 332
333 void MediaSessionImpl::Resume(SuspendType suspend_type) { 333 void MediaSessionImpl::Resume(SuspendType suspend_type) {
334 DCHECK(IsSuspended()); 334 if (!IsSuspended())
whywhat 2017/04/20 19:34:59 Why this change?
Zhiqiang Zhang (Slow) 2017/04/20 21:40:44 As we now throttle the notifications, the notifica
335 return;
335 336
336 if (suspend_type == SuspendType::UI) { 337 if (suspend_type == SuspendType::UI) {
337 MediaSessionUmaHelper::RecordMediaSessionUserAction( 338 MediaSessionUmaHelper::RecordMediaSessionUserAction(
338 MediaSessionUmaHelper::MediaSessionUserAction::PlayDefault); 339 MediaSessionUmaHelper::MediaSessionUserAction::PlayDefault);
339 } 340 }
340 341
341 // When the resume requests comes from another source than system, audio focus 342 // When the resume requests comes from another source than system, audio focus
342 // must be requested. 343 // must be requested.
343 if (suspend_type != SuspendType::SYSTEM) { 344 if (suspend_type != SuspendType::SYSTEM) {
344 // Request audio focus again in case we lost it because another app started 345 // Request audio focus again in case we lost it because another app started
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 if (!IsServiceActiveForRenderFrameHost(frame)) 766 if (!IsServiceActiveForRenderFrameHost(frame))
766 continue; 767 continue;
767 best_frame = frame; 768 best_frame = frame;
768 min_depth = depth; 769 min_depth = depth;
769 } 770 }
770 771
771 return best_frame ? services_[best_frame] : nullptr; 772 return best_frame ? services_[best_frame] : nullptr;
772 } 773 }
773 774
774 } // namespace content 775 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698