OLD | NEW |
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 |
5 #include "chrome/browser/media/router/offscreen_presentation_manager.h" | 5 #include "chrome/browser/media/router/offscreen_presentation_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 << ", [render_frame_host_id]: " << render_frame_host_id.second; | 55 << ", [render_frame_host_id]: " << render_frame_host_id.second; |
56 DCHECK(thread_checker_.CalledOnValidThread()); | 56 DCHECK(thread_checker_.CalledOnValidThread()); |
57 | 57 |
58 auto it = offscreen_presentations_.find(presentation_id); | 58 auto it = offscreen_presentations_.find(presentation_id); |
59 if (it == offscreen_presentations_.end()) | 59 if (it == offscreen_presentations_.end()) |
60 return; | 60 return; |
61 | 61 |
62 // Remove presentation if no controller and receiver. | 62 // Remove presentation if no controller and receiver. |
63 it->second->UnregisterController(render_frame_host_id); | 63 it->second->UnregisterController(render_frame_host_id); |
64 if (!it->second->IsValid()) { | 64 if (!it->second->IsValid()) { |
65 DLOG(WARNING) << __func__ << "no receiver callback has been registered to " | 65 DLOG(WARNING) << __func__ << " no receiver callback has been registered to " |
66 << "[presentation_id]: " << presentation_id; | 66 << "[presentation_id]: " << presentation_id; |
67 offscreen_presentations_.erase(presentation_id); | 67 offscreen_presentations_.erase(presentation_id); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void OffscreenPresentationManager::OnOffscreenPresentationReceiverCreated( | 71 void OffscreenPresentationManager::OnOffscreenPresentationReceiverCreated( |
72 const std::string& presentation_id, | 72 const std::string& presentation_id, |
73 const GURL& presentation_url, | 73 const GURL& presentation_url, |
74 const content::ReceiverConnectionAvailableCallback& receiver_callback) { | 74 const content::ReceiverConnectionAvailableCallback& receiver_callback) { |
75 DVLOG(2) << __FUNCTION__ << " [presentation_id]: " << presentation_id; | 75 DVLOG(2) << __FUNCTION__ << " [presentation_id]: " << presentation_id; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 receiver_callback_ = receiver_callback; | 127 receiver_callback_ = receiver_callback; |
128 pending_controllers_.clear(); | 128 pending_controllers_.clear(); |
129 } | 129 } |
130 | 130 |
131 bool OffscreenPresentationManager::OffscreenPresentation::IsValid() const { | 131 bool OffscreenPresentationManager::OffscreenPresentation::IsValid() const { |
132 return !(pending_controllers_.size() == 0 && receiver_callback_.is_null()); | 132 return !(pending_controllers_.size() == 0 && receiver_callback_.is_null()); |
133 } | 133 } |
134 | 134 |
135 } // namespace media_router | 135 } // namespace media_router |
OLD | NEW |