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

Side by Side Diff: content/browser/renderer_host/media/peer_connection_tracker_host.h

Issue 577483002: Close all active PeerConnections upon OS suspend (relanding r290125 and r291213) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crashing Created 6 years, 3 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 | content/browser/renderer_host/media/peer_connection_tracker_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_
7 7
8 #include "base/power_monitor/power_observer.h"
8 #include "content/public/browser/browser_message_filter.h" 9 #include "content/public/browser/browser_message_filter.h"
9 10
10 struct PeerConnectionInfo; 11 struct PeerConnectionInfo;
11 12
12 namespace base { 13 namespace base {
13 class ListValue; 14 class ListValue;
14 } // namespace base 15 } // namespace base
15 16
16 namespace content { 17 namespace content {
17 18
18 // This class is the host for PeerConnectionTracker in the browser process 19 // This class is the host for PeerConnectionTracker in the browser process
19 // managed by RenderProcessHostImpl. It passes IPC messages between 20 // managed by RenderProcessHostImpl. It receives PeerConnection events from
20 // WebRTCInternals and PeerConnectionTracker. 21 // PeerConnectionTracker as IPC messages that it forwards to WebRTCInternals.
21 class PeerConnectionTrackerHost : public BrowserMessageFilter { 22 // It also forwards browser process events to PeerConnectionTracker via IPC.
23 class PeerConnectionTrackerHost : public BrowserMessageFilter,
24 public base::PowerObserver {
22 public: 25 public:
23 PeerConnectionTrackerHost(int render_process_id); 26 PeerConnectionTrackerHost(int render_process_id);
24 27
25 // content::BrowserMessageFilter override. 28 // content::BrowserMessageFilter override.
26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
27 virtual void OverrideThreadForMessage(const IPC::Message& message, 30 virtual void OverrideThreadForMessage(const IPC::Message& message,
28 BrowserThread::ID* thread) OVERRIDE; 31 BrowserThread::ID* thread) OVERRIDE;
32 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
33 virtual void OnChannelClosing() OVERRIDE;
34
35 // base::PowerObserver override.
36 virtual void OnSuspend() OVERRIDE;
29 37
30 protected: 38 protected:
31 virtual ~PeerConnectionTrackerHost(); 39 virtual ~PeerConnectionTrackerHost();
32 40
33 private: 41 private:
34 // Handlers for peer connection messages coming from the renderer. 42 // Handlers for peer connection messages coming from the renderer.
35 void OnAddPeerConnection(const PeerConnectionInfo& info); 43 void OnAddPeerConnection(const PeerConnectionInfo& info);
36 void OnRemovePeerConnection(int lid); 44 void OnRemovePeerConnection(int lid);
37 void OnUpdatePeerConnection( 45 void OnUpdatePeerConnection(
38 int lid, const std::string& type, const std::string& value); 46 int lid, const std::string& type, const std::string& value);
39 void OnAddStats(int lid, const base::ListValue& value); 47 void OnAddStats(int lid, const base::ListValue& value);
40 void OnGetUserMedia(const std::string& origin, 48 void OnGetUserMedia(const std::string& origin,
41 bool audio, 49 bool audio,
42 bool video, 50 bool video,
43 const std::string& audio_constraints, 51 const std::string& audio_constraints,
44 const std::string& video_constraints); 52 const std::string& video_constraints);
53 void SendOnSuspendOnUIThread();
45 54
46 int render_process_id_; 55 int render_process_id_;
47 56
48 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTrackerHost); 57 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTrackerHost);
49 }; 58 };
50 59
51 } // namespace content 60 } // namespace content
52 61
53 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_ 62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_PEER_CONNECTION_TRACKER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/peer_connection_tracker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698