OLD | NEW |
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/renderer/media/android/renderer_media_session_manager.h" | 5 #include "content/renderer/media/android/renderer_media_session_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/media/media_session_messages_android.h" | 8 #include "content/common/media/media_session_messages_android.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "content/renderer/media/android/webmediasession_android.h" | 10 #include "content/renderer/media/android/webmediasession_android.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 static const int kDefaultMediaSessionID = 0; | |
15 | |
16 RendererMediaSessionManager::RendererMediaSessionManager( | 14 RendererMediaSessionManager::RendererMediaSessionManager( |
17 RenderFrame* render_frame) | 15 RenderFrame* render_frame) |
18 : RenderFrameObserver(render_frame), | 16 : RenderFrameObserver(render_frame), next_session_id_(1) {} |
19 next_session_id_(kDefaultMediaSessionID + 1) {} | |
20 | 17 |
21 RendererMediaSessionManager::~RendererMediaSessionManager() { | 18 RendererMediaSessionManager::~RendererMediaSessionManager() { |
22 DCHECK(sessions_.empty()) | 19 DCHECK(sessions_.empty()) |
23 << "RendererMediaSessionManager is owned by RenderFrameImpl and is " | 20 << "RendererMediaSessionManager is owned by RenderFrameImpl and is " |
24 "destroyed only after all media sessions are destroyed."; | 21 "destroyed only after all media sessions are destroyed."; |
25 } | 22 } |
26 | 23 |
27 bool RendererMediaSessionManager::OnMessageReceived(const IPC::Message& msg) { | 24 bool RendererMediaSessionManager::OnMessageReceived(const IPC::Message& msg) { |
28 bool handled = true; | 25 bool handled = true; |
29 IPC_BEGIN_MESSAGE_MAP(RendererMediaSessionManager, msg) | 26 IPC_BEGIN_MESSAGE_MAP(RendererMediaSessionManager, msg) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 pending_activation_requests_.Remove(request_id); | 69 pending_activation_requests_.Remove(request_id); |
73 } | 70 } |
74 | 71 |
75 void RendererMediaSessionManager::OnDidDeactivate(int request_id) { | 72 void RendererMediaSessionManager::OnDidDeactivate(int request_id) { |
76 DCHECK(pending_deactivation_requests_.Lookup(request_id)) << request_id; | 73 DCHECK(pending_deactivation_requests_.Lookup(request_id)) << request_id; |
77 pending_deactivation_requests_.Lookup(request_id)->onSuccess(); | 74 pending_deactivation_requests_.Lookup(request_id)->onSuccess(); |
78 pending_deactivation_requests_.Remove(request_id); | 75 pending_deactivation_requests_.Remove(request_id); |
79 } | 76 } |
80 | 77 |
81 } // namespace content | 78 } // namespace content |
OLD | NEW |