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

Side by Side Diff: remoting/host/host_signaling_manager.h

Issue 891663005: Add blocking IO restriction on the network thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@it2me_host_dcheck
Patch Set: Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 REMOTING_HOST_HOST_SIGNALING_MANAGER_H_ 5 #ifndef REMOTING_HOST_HOST_SIGNALING_MANAGER_H_
6 #define REMOTING_HOST_HOST_SIGNALING_MANAGER_H_ 6 #define REMOTING_HOST_HOST_SIGNALING_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // |host_offline_reason|, or the |timeout| is reached. Deleting 83 // |host_offline_reason|, or the |timeout| is reached. Deleting
84 // |this| will release |network_task_runner_| and allow the host 84 // |this| will release |network_task_runner_| and allow the host
85 // process to exit. 85 // process to exit.
86 void SendHostOfflineReasonAndDelete(const std::string& host_offline_reason, 86 void SendHostOfflineReasonAndDelete(const std::string& host_offline_reason,
87 const base::TimeDelta& timeout); 87 const base::TimeDelta& timeout);
88 88
89 private: 89 private:
90 HostSignalingManager( 90 HostSignalingManager(
91 scoped_ptr<base::WeakPtrFactory<Listener>> weak_factory_for_listener, 91 scoped_ptr<base::WeakPtrFactory<Listener>> weak_factory_for_listener,
92 const scoped_refptr<AutoThreadTaskRunner>& network_task_runner, 92 const scoped_refptr<AutoThreadTaskRunner>& network_task_runner,
93 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier,
94 scoped_ptr<SignalStrategy> signal_strategy, 93 scoped_ptr<SignalStrategy> signal_strategy,
95 scoped_ptr<SignalingConnector> signaling_connector, 94 scoped_ptr<SignalingConnector> signaling_connector,
96 scoped_ptr<HeartbeatSender> heartbeat_sender); 95 scoped_ptr<HeartbeatSender> heartbeat_sender);
97 96
98 void OnHostOfflineReasonAck(bool success); 97 void OnHostOfflineReasonAck(bool success);
99 98
100 // Used to bind HeartbeatSender and SignalingConnector callbacks to |listener| 99 // Used to bind HeartbeatSender and SignalingConnector callbacks to |listener|
101 // in a way that allows "detaching" the |listener| when either |this| is 100 // in a way that allows "detaching" the |listener| when either |this| is
102 // destroyed or when SendHostOfflineReasonAndDelete method is called. 101 // destroyed or when SendHostOfflineReasonAndDelete method is called.
103 scoped_ptr<base::WeakPtrFactory<Listener>> weak_factory_for_listener_; 102 scoped_ptr<base::WeakPtrFactory<Listener>> weak_factory_for_listener_;
104 103
105 // By holding a reference to |network_task_runner_|, HostSignalingManager is 104 // By holding a reference to |network_task_runner_|, HostSignalingManager is
106 // extending the lifetime of the host process. This is needed for the case 105 // extending the lifetime of the host process. This is needed for the case
107 // where an instance of HostProcess has already been destroyed, but we want 106 // where an instance of HostProcess has already been destroyed, but we want
108 // to keep the process running while we try to establish a connection and send 107 // to keep the process running while we try to establish a connection and send
109 // host-offline-reason. 108 // host-offline-reason.
110 scoped_refptr<AutoThreadTaskRunner> network_task_runner_; 109 scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
111 110
112 // Order of fields below is important for destroying them in the right order. 111 // |heartbeat_sender_| and |signaling_connector_| have to be destroyed before
113 // - |heartbeat_sender_| and |signaling_connector_| have to be destroyed 112 // |signal_strategy_| because their destructors need to call
114 // before |signal_strategy_| because their destructors need to call 113 // signal_strategy_->RemoveListener(this)
115 // signal_strategy_->RemoveListener(this)
116 // - |signaling_connector_| has to be destroyed before
117 // |network_change_notifier_| because its destructor needs to deregister
118 // network change notifications
119 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
120 scoped_ptr<SignalStrategy> signal_strategy_; 114 scoped_ptr<SignalStrategy> signal_strategy_;
121 scoped_ptr<SignalingConnector> signaling_connector_; 115 scoped_ptr<SignalingConnector> signaling_connector_;
122 scoped_ptr<HeartbeatSender> heartbeat_sender_; 116 scoped_ptr<HeartbeatSender> heartbeat_sender_;
123 117
124 DISALLOW_COPY_AND_ASSIGN(HostSignalingManager); 118 DISALLOW_COPY_AND_ASSIGN(HostSignalingManager);
125 }; 119 };
126 120
127 } // namespace remoting 121 } // namespace remoting
128 122
129 #endif // REMOTING_HOST_HOST_SIGNALING_MANAGER_H_ 123 #endif // REMOTING_HOST_HOST_SIGNALING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698