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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 #include "remoting/host/host_main.h" | 54 #include "remoting/host/host_main.h" |
55 #include "remoting/host/host_status_logger.h" | 55 #include "remoting/host/host_status_logger.h" |
56 #include "remoting/host/ipc_constants.h" | 56 #include "remoting/host/ipc_constants.h" |
57 #include "remoting/host/ipc_desktop_environment.h" | 57 #include "remoting/host/ipc_desktop_environment.h" |
58 #include "remoting/host/ipc_host_event_logger.h" | 58 #include "remoting/host/ipc_host_event_logger.h" |
59 #include "remoting/host/logging.h" | 59 #include "remoting/host/logging.h" |
60 #include "remoting/host/me2me_desktop_environment.h" | 60 #include "remoting/host/me2me_desktop_environment.h" |
61 #include "remoting/host/pairing_registry_delegate.h" | 61 #include "remoting/host/pairing_registry_delegate.h" |
62 #include "remoting/host/policy_hack/policy_watcher.h" | 62 #include "remoting/host/policy_hack/policy_watcher.h" |
63 #include "remoting/host/session_manager_factory.h" | 63 #include "remoting/host/session_manager_factory.h" |
64 #include "remoting/host/shutdown_watchdog.h" | |
64 #include "remoting/host/signaling_connector.h" | 65 #include "remoting/host/signaling_connector.h" |
65 #include "remoting/host/single_window_desktop_environment.h" | 66 #include "remoting/host/single_window_desktop_environment.h" |
66 #include "remoting/host/token_validator_factory_impl.h" | 67 #include "remoting/host/token_validator_factory_impl.h" |
67 #include "remoting/host/usage_stats_consent.h" | 68 #include "remoting/host/usage_stats_consent.h" |
68 #include "remoting/host/username.h" | 69 #include "remoting/host/username.h" |
69 #include "remoting/host/video_frame_recorder_host_extension.h" | 70 #include "remoting/host/video_frame_recorder_host_extension.h" |
70 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 71 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
71 #include "remoting/protocol/network_settings.h" | 72 #include "remoting/protocol/network_settings.h" |
72 #include "remoting/protocol/pairing_registry.h" | 73 #include "remoting/protocol/pairing_registry.h" |
73 #include "remoting/protocol/token_validator.h" | 74 #include "remoting/protocol/token_validator.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 bool allow_pairing_; | 310 bool allow_pairing_; |
310 | 311 |
311 bool curtain_required_; | 312 bool curtain_required_; |
312 ThirdPartyAuthConfig third_party_auth_config_; | 313 ThirdPartyAuthConfig third_party_auth_config_; |
313 bool enable_gnubby_auth_; | 314 bool enable_gnubby_auth_; |
314 | 315 |
315 // Boolean to change flow, where ncessary, if we're | 316 // Boolean to change flow, where ncessary, if we're |
316 // capturing a window instead of the entire desktop. | 317 // capturing a window instead of the entire desktop. |
317 bool enable_window_capture_; | 318 bool enable_window_capture_; |
318 | 319 |
320 // Destroying the watchdog will disarm it, so it should be destroyed last. | |
Jamie
2014/12/10 03:02:23
It should be the first member variable in that cas
Łukasz Anforowicz
2014/12/10 17:15:31
It is possible that HostProcess is destroyed, but
| |
321 ShutdownWatchdog shutdown_watchdog_; | |
322 | |
319 // Used to specify which window to stream, if enabled. | 323 // Used to specify which window to stream, if enabled. |
320 webrtc::WindowId window_id_; | 324 webrtc::WindowId window_id_; |
321 | 325 |
322 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; | 326 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; |
323 scoped_ptr<XmppSignalStrategy> signal_strategy_; | 327 scoped_ptr<XmppSignalStrategy> signal_strategy_; |
324 scoped_ptr<SignalingConnector> signaling_connector_; | 328 scoped_ptr<SignalingConnector> signaling_connector_; |
325 scoped_ptr<HeartbeatSender> heartbeat_sender_; | 329 scoped_ptr<HeartbeatSender> heartbeat_sender_; |
326 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; | 330 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; |
327 scoped_ptr<HostStatusLogger> host_status_logger_; | 331 scoped_ptr<HostStatusLogger> host_status_logger_; |
328 scoped_ptr<HostEventLogger> host_event_logger_; | 332 scoped_ptr<HostEventLogger> host_event_logger_; |
(...skipping 22 matching lines...) Expand all Loading... | |
351 frame_recorder_buffer_size_(0), | 355 frame_recorder_buffer_size_(0), |
352 host_username_match_required_(false), | 356 host_username_match_required_(false), |
353 allow_nat_traversal_(true), | 357 allow_nat_traversal_(true), |
354 allow_relay_(true), | 358 allow_relay_(true), |
355 min_udp_port_(0), | 359 min_udp_port_(0), |
356 max_udp_port_(0), | 360 max_udp_port_(0), |
357 allow_pairing_(true), | 361 allow_pairing_(true), |
358 curtain_required_(false), | 362 curtain_required_(false), |
359 enable_gnubby_auth_(false), | 363 enable_gnubby_auth_(false), |
360 enable_window_capture_(false), | 364 enable_window_capture_(false), |
365 shutdown_watchdog_(base::TimeDelta::FromSeconds(15)), | |
Łukasz Anforowicz
2014/12/10 17:15:31
Looks good. I wonder if we should pull all the pr
| |
361 window_id_(0), | 366 window_id_(0), |
362 #if defined(REMOTING_MULTI_PROCESS) | 367 #if defined(REMOTING_MULTI_PROCESS) |
363 desktop_session_connector_(NULL), | 368 desktop_session_connector_(NULL), |
364 #endif // defined(REMOTING_MULTI_PROCESS) | 369 #endif // defined(REMOTING_MULTI_PROCESS) |
365 self_(this), | 370 self_(this), |
366 exit_code_out_(exit_code_out), | 371 exit_code_out_(exit_code_out), |
367 signal_parent_(false) { | 372 signal_parent_(false) { |
368 StartOnUiThread(); | 373 StartOnUiThread(); |
369 } | 374 } |
370 | 375 |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 signaling_connector_.reset(); | 1414 signaling_connector_.reset(); |
1410 oauth_token_getter_.reset(); | 1415 oauth_token_getter_.reset(); |
1411 signal_strategy_.reset(); | 1416 signal_strategy_.reset(); |
1412 network_change_notifier_.reset(); | 1417 network_change_notifier_.reset(); |
1413 | 1418 |
1414 if (state_ == HOST_STOPPING_TO_RESTART) { | 1419 if (state_ == HOST_STOPPING_TO_RESTART) { |
1415 StartHost(); | 1420 StartHost(); |
1416 } else if (state_ == HOST_STOPPING) { | 1421 } else if (state_ == HOST_STOPPING) { |
1417 state_ = HOST_STOPPED; | 1422 state_ = HOST_STOPPED; |
1418 | 1423 |
1424 shutdown_watchdog_.SetExitCode(*exit_code_out_); | |
1425 shutdown_watchdog_.Arm(); | |
1426 | |
1419 if (policy_watcher_.get()) { | 1427 if (policy_watcher_.get()) { |
1420 policy_watcher_->StopWatching( | 1428 policy_watcher_->StopWatching( |
1421 base::Bind(&HostProcess::OnPolicyWatcherShutdown, this)); | 1429 base::Bind(&HostProcess::OnPolicyWatcherShutdown, this)); |
1422 } else { | 1430 } else { |
1423 OnPolicyWatcherShutdown(); | 1431 OnPolicyWatcherShutdown(); |
1424 } | 1432 } |
1425 } else { | 1433 } else { |
1426 // This method is only called in STOPPING_TO_RESTART and STOPPING states. | 1434 // This method is only called in STOPPING_TO_RESTART and STOPPING states. |
1427 NOTREACHED(); | 1435 NOTREACHED(); |
1428 } | 1436 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 int exit_code = kSuccessExitCode; | 1489 int exit_code = kSuccessExitCode; |
1482 new HostProcess(context.Pass(), &exit_code); | 1490 new HostProcess(context.Pass(), &exit_code); |
1483 | 1491 |
1484 // Run the main (also UI) message loop until the host no longer needs it. | 1492 // Run the main (also UI) message loop until the host no longer needs it. |
1485 message_loop.Run(); | 1493 message_loop.Run(); |
1486 | 1494 |
1487 return exit_code; | 1495 return exit_code; |
1488 } | 1496 } |
1489 | 1497 |
1490 } // namespace remoting | 1498 } // namespace remoting |
OLD | NEW |