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

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 1123163002: Updated remoting host to create instances of GCD-related classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-xmpp-connect2c
Patch Set: for review Created 5 years, 7 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 | remoting/host/signaling_connector.h » ('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) 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/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 26 matching lines...) Expand all
37 #include "remoting/base/util.h" 37 #include "remoting/base/util.h"
38 #include "remoting/host/branding.h" 38 #include "remoting/host/branding.h"
39 #include "remoting/host/chromoting_host.h" 39 #include "remoting/host/chromoting_host.h"
40 #include "remoting/host/chromoting_host_context.h" 40 #include "remoting/host/chromoting_host_context.h"
41 #include "remoting/host/chromoting_messages.h" 41 #include "remoting/host/chromoting_messages.h"
42 #include "remoting/host/config_file_watcher.h" 42 #include "remoting/host/config_file_watcher.h"
43 #include "remoting/host/config_watcher.h" 43 #include "remoting/host/config_watcher.h"
44 #include "remoting/host/desktop_environment.h" 44 #include "remoting/host/desktop_environment.h"
45 #include "remoting/host/desktop_session_connector.h" 45 #include "remoting/host/desktop_session_connector.h"
46 #include "remoting/host/dns_blackhole_checker.h" 46 #include "remoting/host/dns_blackhole_checker.h"
47 #include "remoting/host/gcd_rest_client.h"
48 #include "remoting/host/gcd_state_updater.h"
47 #include "remoting/host/heartbeat_sender.h" 49 #include "remoting/host/heartbeat_sender.h"
48 #include "remoting/host/host_change_notification_listener.h" 50 #include "remoting/host/host_change_notification_listener.h"
49 #include "remoting/host/host_config.h" 51 #include "remoting/host/host_config.h"
50 #include "remoting/host/host_event_logger.h" 52 #include "remoting/host/host_event_logger.h"
51 #include "remoting/host/host_exit_codes.h" 53 #include "remoting/host/host_exit_codes.h"
52 #include "remoting/host/host_main.h" 54 #include "remoting/host/host_main.h"
53 #include "remoting/host/host_status_logger.h" 55 #include "remoting/host/host_status_logger.h"
54 #include "remoting/host/ipc_constants.h" 56 #include "remoting/host/ipc_constants.h"
55 #include "remoting/host/ipc_desktop_environment.h" 57 #include "remoting/host/ipc_desktop_environment.h"
56 #include "remoting/host/ipc_host_event_logger.h" 58 #include "remoting/host/ipc_host_event_logger.h"
57 #include "remoting/host/logging.h" 59 #include "remoting/host/logging.h"
58 #include "remoting/host/me2me_desktop_environment.h" 60 #include "remoting/host/me2me_desktop_environment.h"
59 #include "remoting/host/pairing_registry_delegate.h" 61 #include "remoting/host/pairing_registry_delegate.h"
60 #include "remoting/host/policy_watcher.h" 62 #include "remoting/host/policy_watcher.h"
61 #include "remoting/host/session_manager_factory.h" 63 #include "remoting/host/session_manager_factory.h"
62 #include "remoting/host/shutdown_watchdog.h" 64 #include "remoting/host/shutdown_watchdog.h"
63 #include "remoting/host/signaling_connector.h" 65 #include "remoting/host/signaling_connector.h"
64 #include "remoting/host/single_window_desktop_environment.h" 66 #include "remoting/host/single_window_desktop_environment.h"
65 #include "remoting/host/third_party_auth_config.h" 67 #include "remoting/host/third_party_auth_config.h"
66 #include "remoting/host/token_validator_factory_impl.h" 68 #include "remoting/host/token_validator_factory_impl.h"
67 #include "remoting/host/usage_stats_consent.h" 69 #include "remoting/host/usage_stats_consent.h"
68 #include "remoting/host/username.h" 70 #include "remoting/host/username.h"
69 #include "remoting/host/video_frame_recorder_host_extension.h" 71 #include "remoting/host/video_frame_recorder_host_extension.h"
70 #include "remoting/protocol/me2me_host_authenticator_factory.h" 72 #include "remoting/protocol/me2me_host_authenticator_factory.h"
71 #include "remoting/protocol/network_settings.h" 73 #include "remoting/protocol/network_settings.h"
72 #include "remoting/protocol/pairing_registry.h" 74 #include "remoting/protocol/pairing_registry.h"
73 #include "remoting/protocol/port_range.h" 75 #include "remoting/protocol/port_range.h"
74 #include "remoting/protocol/token_validator.h" 76 #include "remoting/protocol/token_validator.h"
77 #include "remoting/signaling/push_notification_subscriber.h"
75 #include "remoting/signaling/xmpp_signal_strategy.h" 78 #include "remoting/signaling/xmpp_signal_strategy.h"
76 79
77 #if defined(OS_POSIX) 80 #if defined(OS_POSIX)
78 #include <signal.h> 81 #include <signal.h>
79 #include <sys/types.h> 82 #include <sys/types.h>
80 #include <unistd.h> 83 #include <unistd.h>
81 #include "base/file_descriptor_posix.h" 84 #include "base/file_descriptor_posix.h"
82 #include "remoting/host/pam_authorization_factory_posix.h" 85 #include "remoting/host/pam_authorization_factory_posix.h"
83 #include "remoting/host/posix/signal_handler.h" 86 #include "remoting/host/posix/signal_handler.h"
84 #endif // defined(OS_POSIX) 87 #endif // defined(OS_POSIX)
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 IPC::PlatformFileForTransit unprivileged_key); 300 IPC::PlatformFileForTransit unprivileged_key);
298 #endif // defined(OS_WIN) 301 #endif // defined(OS_WIN)
299 302
300 // Crashes the process in response to a daemon's request. The daemon passes 303 // Crashes the process in response to a daemon's request. The daemon passes
301 // the location of the code that detected the fatal error resulted in this 304 // the location of the code that detected the fatal error resulted in this
302 // request. 305 // request.
303 void OnCrash(const std::string& function_name, 306 void OnCrash(const std::string& function_name,
304 const std::string& file_name, 307 const std::string& file_name,
305 const int& line_number); 308 const int& line_number);
306 309
310 bool using_gcd() { return !gcd_device_id_.empty(); }
311
307 scoped_ptr<ChromotingHostContext> context_; 312 scoped_ptr<ChromotingHostContext> context_;
308 313
309 // Accessed on the UI thread. 314 // Accessed on the UI thread.
310 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 315 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
311 316
312 // XMPP server/remoting bot configuration (initialized from the command line). 317 // XMPP server/remoting bot configuration (initialized from the command line).
313 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 318 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
314 std::string directory_bot_jid_; 319 std::string directory_bot_jid_;
315 320
316 // Created on the UI thread but used from the network thread. 321 // Created on the UI thread but used from the network thread.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 ThirdPartyAuthConfig third_party_auth_config_; 354 ThirdPartyAuthConfig third_party_auth_config_;
350 bool enable_gnubby_auth_; 355 bool enable_gnubby_auth_;
351 356
352 // Boolean to change flow, where necessary, if we're 357 // Boolean to change flow, where necessary, if we're
353 // capturing a window instead of the entire desktop. 358 // capturing a window instead of the entire desktop.
354 bool enable_window_capture_; 359 bool enable_window_capture_;
355 360
356 // Used to specify which window to stream, if enabled. 361 // Used to specify which window to stream, if enabled.
357 webrtc::WindowId window_id_; 362 webrtc::WindowId window_id_;
358 363
359 // |heartbeat_sender_| and |signaling_connector_| have to be destroyed before 364 // Must outlive |gcd_rest_client_| and |signaling_connector_|.
360 // |signal_strategy_| because their destructors need to call 365 scoped_ptr<OAuthTokenGetter> oauth_token_getter_;
361 // signal_strategy_->RemoveListener(this) 366
367 // Must outlive |gcd_state_updater_|.
368 scoped_ptr<GcdRestClient> gcd_rest_client_;
Sergey Ulanov 2015/06/03 22:25:35 Do we really need this here? Can OAuthTokenGetter
John Williams 2015/06/06 02:55:06 GcdStateUpdater could own it. It might even make
Sergey Ulanov 2015/06/08 17:02:31 I still think it's better to move ownership of Gcd
369
370 // Must outlive |signaling_connector_|, |gcd_subscriber_|, and
371 // |heartbeat_sender_|.
362 scoped_ptr<SignalStrategy> signal_strategy_; 372 scoped_ptr<SignalStrategy> signal_strategy_;
373
363 scoped_ptr<SignalingConnector> signaling_connector_; 374 scoped_ptr<SignalingConnector> signaling_connector_;
364 scoped_ptr<HeartbeatSender> heartbeat_sender_; 375 scoped_ptr<HeartbeatSender> heartbeat_sender_;
376 scoped_ptr<GcdStateUpdater> gcd_state_updater_;
377 scoped_ptr<PushNotificationSubscriber> gcd_subscriber_;
365 378
366 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; 379 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
367 scoped_ptr<HostStatusLogger> host_status_logger_; 380 scoped_ptr<HostStatusLogger> host_status_logger_;
368 scoped_ptr<HostEventLogger> host_event_logger_; 381 scoped_ptr<HostEventLogger> host_event_logger_;
369 382
370 scoped_ptr<ChromotingHost> host_; 383 scoped_ptr<ChromotingHost> host_;
371 384
372 // Used to keep this HostProcess alive until it is shutdown. 385 // Used to keep this HostProcess alive until it is shutdown.
373 scoped_refptr<HostProcess> self_; 386 scoped_refptr<HostProcess> self_;
374 387
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 HOST_LOG << "Policy disables gnubby auth."; 1310 HOST_LOG << "Policy disables gnubby auth.";
1298 } 1311 }
1299 1312
1300 if (desktop_environment_factory_) 1313 if (desktop_environment_factory_)
1301 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_); 1314 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_);
1302 1315
1303 return true; 1316 return true;
1304 } 1317 }
1305 1318
1306 void HostProcess::InitializeSignaling() { 1319 void HostProcess::InitializeSignaling() {
1307 DCHECK(!host_id_.empty()); // |ApplyConfig| should already have been run. 1320 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run.
1308 DCHECK(!signal_strategy_); 1321 DCHECK(!signal_strategy_);
1322 DCHECK(!oauth_token_getter_);
1323 DCHECK(!signaling_connector_);
1324 DCHECK(!gcd_rest_client_);
1325 DCHECK(!gcd_state_updater_);
1326 DCHECK(!gcd_subscriber_);
1327 DCHECK(!heartbeat_sender_);
1309 1328
1310 // Create SignalStrategy. 1329 // Create SignalStrategy.
1311 XmppSignalStrategy* xmpp_signal_strategy = new XmppSignalStrategy( 1330 XmppSignalStrategy* xmpp_signal_strategy = new XmppSignalStrategy(
1312 net::ClientSocketFactory::GetDefaultFactory(), 1331 net::ClientSocketFactory::GetDefaultFactory(),
1313 context_->url_request_context_getter(), xmpp_server_config_); 1332 context_->url_request_context_getter(), xmpp_server_config_);
1314 signal_strategy_.reset(xmpp_signal_strategy); 1333 signal_strategy_.reset(xmpp_signal_strategy);
1315 1334
1316 // Create SignalingConnector. 1335 // Create SignalingConnector.
1317 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(new DnsBlackholeChecker( 1336 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(new DnsBlackholeChecker(
1318 context_->url_request_context_getter(), talkgadget_prefix_)); 1337 context_->url_request_context_getter(), talkgadget_prefix_));
1319 scoped_ptr<OAuthTokenGetter::OAuthCredentials> oauth_credentials( 1338 scoped_ptr<OAuthTokenGetter::OAuthCredentials> oauth_credentials(
1320 new OAuthTokenGetter::OAuthCredentials(xmpp_server_config_.username, 1339 new OAuthTokenGetter::OAuthCredentials(xmpp_server_config_.username,
1321 oauth_refresh_token_, 1340 oauth_refresh_token_,
1322 use_service_account_)); 1341 use_service_account_));
1323 scoped_ptr<OAuthTokenGetter> oauth_token_getter(new OAuthTokenGetter( 1342 oauth_token_getter_.reset(new OAuthTokenGetter(
1324 oauth_credentials.Pass(), context_->url_request_context_getter(), false, 1343 oauth_credentials.Pass(), context_->url_request_context_getter(), false,
1325 gcd_device_id_.empty())); 1344 !using_gcd()));
1326 signaling_connector_.reset(new SignalingConnector( 1345 signaling_connector_.reset(new SignalingConnector(
1327 xmpp_signal_strategy, dns_blackhole_checker.Pass(), 1346 xmpp_signal_strategy, dns_blackhole_checker.Pass(),
1328 oauth_token_getter.Pass(), 1347 oauth_token_getter_.get(),
1329 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); 1348 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this))));
1330 1349
1331 // Create HeartbeatSender. 1350 if (using_gcd()) {
1332 heartbeat_sender_.reset(new HeartbeatSender( 1351 // Create objects to manage GCD state.
1333 base::Bind(&HostProcess::OnHeartbeatSuccessful, base::Unretained(this)), 1352 ServiceUrls* service_urls = ServiceUrls::GetInstance();
1334 base::Bind(&HostProcess::OnUnknownHostIdError, base::Unretained(this)), 1353 gcd_rest_client_.reset(new GcdRestClient(
1335 host_id_, xmpp_signal_strategy, key_pair_, directory_bot_jid_)); 1354 service_urls->gcd_base_url(), gcd_device_id_,
1355 context_->url_request_context_getter(), oauth_token_getter_.get()));
1356 gcd_state_updater_.reset(
1357 new GcdStateUpdater(base::Bind(&HostProcess::OnHeartbeatSuccessful,
1358 base::Unretained(this)),
1359 // TODO(jrw): Add callback for
1360 // OnUnknownHostIdError.
1361 signal_strategy_.get(), gcd_rest_client_.get()));
1362
1363 PushNotificationSubscriber::Subscription sub;
1364 sub.channel = "cloud_devices";
1365 PushNotificationSubscriber::SubscriptionList subs;
1366 subs.push_back(sub);
1367 gcd_subscriber_.reset(
1368 new PushNotificationSubscriber(signal_strategy_.get(), subs));
1369 } else {
1370 // Create HeartbeatSender.
1371 heartbeat_sender_.reset(new HeartbeatSender(
1372 base::Bind(&HostProcess::OnHeartbeatSuccessful, base::Unretained(this)),
1373 base::Bind(&HostProcess::OnUnknownHostIdError, base::Unretained(this)),
1374 host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_));
1375 }
1336 } 1376 }
1337 1377
1378
Sergey Ulanov 2015/06/03 22:25:35 remove extra empty line
John Williams 2015/06/06 02:55:06 Done.
1338 void HostProcess::StartHostIfReady() { 1379 void HostProcess::StartHostIfReady() {
1339 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 1380 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
1340 DCHECK_EQ(state_, HOST_STARTING); 1381 DCHECK_EQ(state_, HOST_STARTING);
1341 1382
1342 // Start the host if both the config and the policies are loaded. 1383 // Start the host if both the config and the policies are loaded.
1343 if (!serialized_config_.empty()) { 1384 if (!serialized_config_.empty()) {
1344 if (policy_state_ == POLICY_LOADED) { 1385 if (policy_state_ == POLICY_LOADED) {
1345 StartHost(); 1386 StartHost();
1346 } else if (policy_state_ == POLICY_ERROR_REPORT_PENDING) { 1387 } else if (policy_state_ == POLICY_ERROR_REPORT_PENDING) {
1347 ReportPolicyErrorAndRestartHost(); 1388 ReportPolicyErrorAndRestartHost();
1348 } 1389 }
1349 } 1390 }
1350 } 1391 }
1351 1392
1352 void HostProcess::StartHost() { 1393 void HostProcess::StartHost() {
1353 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 1394 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
1354 DCHECK(!host_); 1395 DCHECK(!host_);
1396 DCHECK(!gcd_rest_client_);
1355 1397
1356 SetState(HOST_STARTED); 1398 SetState(HOST_STARTED);
1357 1399
1358 InitializeSignaling(); 1400 InitializeSignaling();
1359 1401
1360 uint32 network_flags = 0; 1402 uint32 network_flags = 0;
1361 if (allow_nat_traversal_) { 1403 if (allow_nat_traversal_) {
1362 network_flags = NetworkSettings::NAT_TRAVERSAL_STUN | 1404 network_flags = NetworkSettings::NAT_TRAVERSAL_STUN |
1363 NetworkSettings::NAT_TRAVERSAL_OUTGOING; 1405 NetworkSettings::NAT_TRAVERSAL_OUTGOING;
1364 if (allow_relay_) 1406 if (allow_relay_)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 } 1443 }
1402 1444
1403 // TODO(simonmorris): Get the maximum session duration from a policy. 1445 // TODO(simonmorris): Get the maximum session duration from a policy.
1404 #if defined(OS_LINUX) 1446 #if defined(OS_LINUX)
1405 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 1447 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
1406 #endif 1448 #endif
1407 1449
1408 host_change_notification_listener_.reset(new HostChangeNotificationListener( 1450 host_change_notification_listener_.reset(new HostChangeNotificationListener(
1409 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); 1451 this, host_id_, signal_strategy_.get(), directory_bot_jid_));
1410 1452
1411 host_status_logger_.reset( 1453 if (using_gcd()) {
1412 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::ME2ME, 1454 // TODO(jrw): Implement logging for GCD hosts.
1413 signal_strategy_.get(), directory_bot_jid_)); 1455 HOST_LOG << "Logging not implemented for GCD hosts.";
1456 } else {
1457 host_status_logger_.reset(new HostStatusLogger(
1458 host_->AsWeakPtr(), ServerLogEntry::ME2ME,
1459 signal_strategy_.get(), directory_bot_jid_));
1460 }
1414 1461
1415 // Set up reporting the host status notifications. 1462 // Set up reporting the host status notifications.
1416 #if defined(REMOTING_MULTI_PROCESS) 1463 #if defined(REMOTING_MULTI_PROCESS)
1417 host_event_logger_.reset( 1464 host_event_logger_.reset(
1418 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); 1465 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get()));
1419 #else // !defined(REMOTING_MULTI_PROCESS) 1466 #else // !defined(REMOTING_MULTI_PROCESS)
1420 host_event_logger_ = 1467 host_event_logger_ =
1421 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); 1468 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName);
1422 #endif // !defined(REMOTING_MULTI_PROCESS) 1469 #endif // !defined(REMOTING_MULTI_PROCESS)
1423 1470
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 host_status_logger_.reset(); 1524 host_status_logger_.reset();
1478 host_change_notification_listener_.reset(); 1525 host_change_notification_listener_.reset();
1479 1526
1480 // Before shutting down HostSignalingManager, send the |host_offline_reason| 1527 // Before shutting down HostSignalingManager, send the |host_offline_reason|
1481 // if possible (i.e. if we have the config). 1528 // if possible (i.e. if we have the config).
1482 if (!serialized_config_.empty()) { 1529 if (!serialized_config_.empty()) {
1483 if (!signal_strategy_) 1530 if (!signal_strategy_)
1484 InitializeSignaling(); 1531 InitializeSignaling();
1485 1532
1486 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << "."; 1533 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << ".";
1487 heartbeat_sender_->SetHostOfflineReason( 1534 if (heartbeat_sender_) {
1488 host_offline_reason, 1535 heartbeat_sender_->SetHostOfflineReason(
1489 base::TimeDelta::FromSeconds(kHostOfflineReasonTimeoutSeconds), 1536 host_offline_reason,
1490 base::Bind(&HostProcess::OnHostOfflineReasonAck, this)); 1537 base::TimeDelta::FromSeconds(kHostOfflineReasonTimeoutSeconds),
1538 base::Bind(&HostProcess::OnHostOfflineReasonAck, this));
1539 }
1540 if (gcd_state_updater_) {
1541 gcd_state_updater_->SetHostOfflineReason(
1542 host_offline_reason,
1543 base::TimeDelta::FromSeconds(kHostOfflineReasonTimeoutSeconds),
1544 base::Bind(&HostProcess::OnHostOfflineReasonAck, this));
1545 }
1491 return; // Shutdown will resume after OnHostOfflineReasonAck. 1546 return; // Shutdown will resume after OnHostOfflineReasonAck.
1492 } 1547 }
1493 1548
1494 // Continue the shutdown without sending the host offline reason. 1549 // Continue the shutdown without sending the host offline reason.
1495 HOST_LOG << "Can't send offline reason (" << host_offline_reason << ") " 1550 HOST_LOG << "Can't send offline reason (" << host_offline_reason << ") "
1496 << "without a valid host config."; 1551 << "without a valid host config.";
1497 OnHostOfflineReasonAck(false); 1552 OnHostOfflineReasonAck(false);
1498 } 1553 }
1499 1554
1500 void HostProcess::OnHostOfflineReasonAck(bool success) { 1555 void HostProcess::OnHostOfflineReasonAck(bool success) {
1501 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 1556 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
1502 DCHECK(!host_); // Assert that the host is really offline at this point. 1557 DCHECK(!host_); // Assert that the host is really offline at this point.
1503 1558
1504 HOST_LOG << "SendHostOfflineReason " << (success ? "succeeded." : "failed."); 1559 HOST_LOG << "SendHostOfflineReason " << (success ? "succeeded." : "failed.");
1505 heartbeat_sender_.reset(); 1560 heartbeat_sender_.reset();
1561 oauth_token_getter_.reset();
1506 signaling_connector_.reset(); 1562 signaling_connector_.reset();
1507 signal_strategy_.reset(); 1563 signal_strategy_.reset();
1564 gcd_state_updater_.reset();
1565 gcd_subscriber_.reset();
1566 gcd_rest_client_.reset();
1508 1567
1509 if (state_ == HOST_GOING_OFFLINE_TO_RESTART) { 1568 if (state_ == HOST_GOING_OFFLINE_TO_RESTART) {
1510 SetState(HOST_STARTING); 1569 SetState(HOST_STARTING);
1511 StartHostIfReady(); 1570 StartHostIfReady();
1512 } else if (state_ == HOST_GOING_OFFLINE_TO_STOP) { 1571 } else if (state_ == HOST_GOING_OFFLINE_TO_STOP) {
1513 SetState(HOST_STOPPED); 1572 SetState(HOST_STOPPED);
1514 1573
1515 shutdown_watchdog_->SetExitCode(*exit_code_out_); 1574 shutdown_watchdog_->SetExitCode(*exit_code_out_);
1516 shutdown_watchdog_->Arm(); 1575 shutdown_watchdog_->Arm();
1517 1576
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1635 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1577 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); 1636 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog);
1578 1637
1579 // Run the main (also UI) message loop until the host no longer needs it. 1638 // Run the main (also UI) message loop until the host no longer needs it.
1580 message_loop.Run(); 1639 message_loop.Run();
1581 1640
1582 return exit_code; 1641 return exit_code;
1583 } 1642 }
1584 1643
1585 } // namespace remoting 1644 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/signaling_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698