OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 const char kStdinConfigPath[] = "-"; | 135 const char kStdinConfigPath[] = "-"; |
136 | 136 |
137 const char kWindowIdSwitchName[] = "window-id"; | 137 const char kWindowIdSwitchName[] = "window-id"; |
138 | 138 |
139 } // namespace | 139 } // namespace |
140 | 140 |
141 namespace remoting { | 141 namespace remoting { |
142 | 142 |
143 class HostProcess | 143 class HostProcess |
144 : public ConfigWatcher::Delegate, | 144 : public ConfigWatcher::Delegate, |
145 public HeartbeatSender::Listener, | |
146 public HostChangeNotificationListener::Listener, | 145 public HostChangeNotificationListener::Listener, |
147 public IPC::Listener, | 146 public IPC::Listener, |
148 public base::RefCountedThreadSafe<HostProcess> { | 147 public base::RefCountedThreadSafe<HostProcess> { |
149 public: | 148 public: |
150 HostProcess(scoped_ptr<ChromotingHostContext> context, | 149 HostProcess(scoped_ptr<ChromotingHostContext> context, |
151 int* exit_code_out); | 150 int* exit_code_out); |
152 | 151 |
153 // ConfigWatcher::Delegate interface. | 152 // ConfigWatcher::Delegate interface. |
154 virtual void OnConfigUpdated(const std::string& serialized_config) override; | 153 virtual void OnConfigUpdated(const std::string& serialized_config) override; |
155 virtual void OnConfigWatcherError() override; | 154 virtual void OnConfigWatcherError() override; |
156 | 155 |
157 // IPC::Listener implementation. | 156 // IPC::Listener implementation. |
158 virtual bool OnMessageReceived(const IPC::Message& message) override; | 157 virtual bool OnMessageReceived(const IPC::Message& message) override; |
159 virtual void OnChannelError() override; | 158 virtual void OnChannelError() override; |
160 | 159 |
161 // HeartbeatSender::Listener overrides. | 160 // HeartbeatSender callbacks |
Lambros
2014/11/18 00:19:30
nit: period.
Actually, I'm not sure you need this
Łukasz Anforowicz
2014/11/18 01:03:22
Yes - good point. These methods don't need to be
| |
162 virtual void OnHeartbeatSuccessful() override; | 161 void OnHeartbeatSuccessful(); |
163 virtual void OnUnknownHostIdError() override; | 162 void OnUnknownHostIdError(); |
164 | 163 |
165 // HostChangeNotificationListener::Listener overrides. | 164 // HostChangeNotificationListener::Listener overrides. |
166 virtual void OnHostDeleted() override; | 165 virtual void OnHostDeleted() override; |
167 | 166 |
168 // Initializes the pairing registry on Windows. | 167 // Initializes the pairing registry on Windows. |
169 void OnInitializePairingRegistry( | 168 void OnInitializePairingRegistry( |
170 IPC::PlatformFileForTransit privileged_key, | 169 IPC::PlatformFileForTransit privileged_key, |
171 IPC::PlatformFileForTransit unprivileged_key); | 170 IPC::PlatformFileForTransit unprivileged_key); |
172 | 171 |
173 private: | 172 private: |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1315 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); | 1314 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); |
1316 host_->AddExtension(frame_recorder_extension.Pass()); | 1315 host_->AddExtension(frame_recorder_extension.Pass()); |
1317 } | 1316 } |
1318 | 1317 |
1319 // TODO(simonmorris): Get the maximum session duration from a policy. | 1318 // TODO(simonmorris): Get the maximum session duration from a policy. |
1320 #if defined(OS_LINUX) | 1319 #if defined(OS_LINUX) |
1321 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1320 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
1322 #endif | 1321 #endif |
1323 | 1322 |
1324 heartbeat_sender_.reset(new HeartbeatSender( | 1323 heartbeat_sender_.reset(new HeartbeatSender( |
1325 this, host_id_, signal_strategy_.get(), key_pair_, | 1324 base::Bind(&HostProcess::OnHeartbeatSuccessful, base::Unretained(this)), |
Lambros
2014/11/18 00:19:30
Why do we need base::Unretained here? This is a re
Łukasz Anforowicz
2014/11/18 01:03:22
This temporarily follows other references to |this
Lambros
2014/11/18 02:33:52
I see. I'm curious to know if this still compiles
Łukasz Anforowicz
2014/11/18 17:30:45
It would compile without base::Unretained and woul
| |
1326 directory_bot_jid_)); | 1325 base::Bind(&HostProcess::OnUnknownHostIdError, base::Unretained(this)), |
1326 host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_)); | |
1327 | 1327 |
1328 host_change_notification_listener_.reset(new HostChangeNotificationListener( | 1328 host_change_notification_listener_.reset(new HostChangeNotificationListener( |
1329 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); | 1329 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); |
1330 | 1330 |
1331 host_status_logger_.reset( | 1331 host_status_logger_.reset( |
1332 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::ME2ME, | 1332 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::ME2ME, |
1333 signal_strategy_.get(), directory_bot_jid_)); | 1333 signal_strategy_.get(), directory_bot_jid_)); |
1334 | 1334 |
1335 // Set up reporting the host status notifications. | 1335 // Set up reporting the host status notifications. |
1336 #if defined(REMOTING_MULTI_PROCESS) | 1336 #if defined(REMOTING_MULTI_PROCESS) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1480 int exit_code = kSuccessExitCode; | 1480 int exit_code = kSuccessExitCode; |
1481 new HostProcess(context.Pass(), &exit_code); | 1481 new HostProcess(context.Pass(), &exit_code); |
1482 | 1482 |
1483 // Run the main (also UI) message loop until the host no longer needs it. | 1483 // Run the main (also UI) message loop until the host no longer needs it. |
1484 message_loop.Run(); | 1484 message_loop.Run(); |
1485 | 1485 |
1486 return exit_code; | 1486 return exit_code; |
1487 } | 1487 } |
1488 | 1488 |
1489 } // namespace remoting | 1489 } // namespace remoting |
OLD | NEW |