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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_observers.cc

Issue 2633053002: Remove the MessageLoop::DestructionObserver from mojo bindings. (Closed)
Patch Set: rebase Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/media/router/presentation_service_delegate_observers.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_observers.h"
5 6
7 #include "base/stl_util.h"
8
6 namespace media_router { 9 namespace media_router {
7 10
8 PresentationServiceDelegateObservers::PresentationServiceDelegateObservers() {} 11 PresentationServiceDelegateObservers::PresentationServiceDelegateObservers() {}
9 12
10 PresentationServiceDelegateObservers::~PresentationServiceDelegateObservers() { 13 PresentationServiceDelegateObservers::~PresentationServiceDelegateObservers() {
11 for (auto& observer_pair : observers_) 14 for (auto& observer_pair : observers_)
12 observer_pair.second->OnDelegateDestroyed(); 15 observer_pair.second->OnDelegateDestroyed();
13 } 16 }
14 17
15 void PresentationServiceDelegateObservers::AddObserver( 18 void PresentationServiceDelegateObservers::AddObserver(
16 int render_process_id, 19 int render_process_id,
17 int render_frame_id, 20 int render_frame_id,
18 content::PresentationServiceDelegate::Observer* observer) { 21 content::PresentationServiceDelegate::Observer* observer) {
19 DCHECK(observer); 22 DCHECK(observer);
20 23
21 RenderFrameHostId rfh_id(render_process_id, render_frame_id); 24 RenderFrameHostId rfh_id(render_process_id, render_frame_id);
22 DCHECK(!base::ContainsKey(observers_, rfh_id)); 25 DCHECK(!base::ContainsKey(observers_, rfh_id));
23 observers_[rfh_id] = observer; 26 observers_[rfh_id] = observer;
24 } 27 }
25 28
26 void PresentationServiceDelegateObservers::RemoveObserver(int render_process_id, 29 void PresentationServiceDelegateObservers::RemoveObserver(int render_process_id,
27 int render_frame_id) { 30 int render_frame_id) {
28 observers_.erase(RenderFrameHostId(render_process_id, render_frame_id)); 31 observers_.erase(RenderFrameHostId(render_process_id, render_frame_id));
29 } 32 }
30 33
31 } // namespace media_router 34 } // namespace media_router
OLDNEW
« no previous file with comments | « ash/common/media_controller.h ('k') | content/browser/battery_status/battery_monitor_integration_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698