Chromium Code Reviews| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 using remoting::protocol::PairingRegistry; | 110 using remoting::protocol::PairingRegistry; |
| 111 using remoting::protocol::NetworkSettings; | 111 using remoting::protocol::NetworkSettings; |
| 112 | 112 |
| 113 #if defined(USE_REMOTING_MACOSX_INTERNAL) | 113 #if defined(USE_REMOTING_MACOSX_INTERNAL) |
| 114 #include "remoting/tools/internal/internal_mac-inl.h" | 114 #include "remoting/tools/internal/internal_mac-inl.h" |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 namespace { | 117 namespace { |
| 118 | 118 |
| 119 #if !defined(REMOTING_MULTI_PROCESS) | |
| 119 // This is used for tagging system event logs. | 120 // This is used for tagging system event logs. |
| 120 const char kApplicationName[] = "chromoting"; | 121 const char kApplicationName[] = "chromoting"; |
| 121 | 122 |
| 123 // Value used for --host-config option to indicate that the path must be read | |
| 124 // from stdin. | |
| 125 const char kStdinConfigPath[] = "-"; | |
| 126 #endif // !defined(REMOTING_MULTI_PROCESS) | |
| 127 | |
| 122 #if defined(OS_LINUX) | 128 #if defined(OS_LINUX) |
| 123 // The command line switch used to pass name of the pipe to capture audio on | 129 // The command line switch used to pass name of the pipe to capture audio on |
| 124 // linux. | 130 // linux. |
| 125 const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 131 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
| 126 | 132 |
| 127 // The command line switch used to pass name of the unix domain socket used to | 133 // The command line switch used to pass name of the unix domain socket used to |
| 128 // listen for gnubby requests. | 134 // listen for gnubby requests. |
| 129 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; | 135 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; |
| 130 #endif // defined(OS_LINUX) | 136 #endif // defined(OS_LINUX) |
| 131 | 137 |
| 132 // The command line switch used by the parent to request the host to signal it | 138 // The command line switch used by the parent to request the host to signal it |
| 133 // when it is successfully started. | 139 // when it is successfully started. |
| 134 const char kSignalParentSwitchName[] = "signal-parent"; | 140 const char kSignalParentSwitchName[] = "signal-parent"; |
| 135 | 141 |
| 136 // Command line switch used to enable VP9 encoding. | 142 // Command line switch used to enable VP9 encoding. |
| 137 const char kEnableVp9SwitchName[] = "enable-vp9"; | 143 const char kEnableVp9SwitchName[] = "enable-vp9"; |
| 138 | 144 |
| 139 // Command line switch used to enable and configure the frame-recorder. | 145 // Command line switch used to enable and configure the frame-recorder. |
| 140 const char kFrameRecorderBufferKbName[] = "frame-recorder-buffer-kb"; | 146 const char kFrameRecorderBufferKbName[] = "frame-recorder-buffer-kb"; |
| 141 | 147 |
| 142 // Value used for --host-config option to indicate that the path must be read | |
| 143 // from stdin. | |
| 144 const char kStdinConfigPath[] = "-"; | |
| 145 | |
| 146 const char kWindowIdSwitchName[] = "window-id"; | 148 const char kWindowIdSwitchName[] = "window-id"; |
| 147 | 149 |
| 148 // Maximum time to wait for clean shutdown to occur, before forcing termination | 150 // Maximum time to wait for clean shutdown to occur, before forcing termination |
| 149 // of the process. | 151 // of the process. |
| 150 const int kShutdownTimeoutSeconds = 15; | 152 const int kShutdownTimeoutSeconds = 15; |
| 151 | 153 |
| 152 // Maximum time to wait for reporting host-offline-reason to the service, | 154 // Maximum time to wait for reporting host-offline-reason to the service, |
| 153 // before continuing normal process shutdown. | 155 // before continuing normal process shutdown. |
| 154 const int kHostOfflineReasonTimeoutSeconds = 10; | 156 const int kHostOfflineReasonTimeoutSeconds = 10; |
| 155 | 157 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 IPC::Channel::MODE_CLIENT, | 481 IPC::Channel::MODE_CLIENT, |
| 480 this, | 482 this, |
| 481 context_->network_task_runner().get()); | 483 context_->network_task_runner().get()); |
| 482 } | 484 } |
| 483 | 485 |
| 484 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 486 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
| 485 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 487 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
| 486 | 488 |
| 487 // Read config from stdin if necessary. | 489 // Read config from stdin if necessary. |
| 488 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 490 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
| 489 char buf[4096]; | 491 char buf[4096]; |
|
cpu_(ooo_6.6-7.5)
2015/07/07 17:39:24
stack allocations this big are bad news. I basical
Matt Giuca
2015/07/08 02:51:28
According to remoting/remoting_options.gypi, it is
| |
| 490 size_t len; | 492 size_t len; |
| 491 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { | 493 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { |
| 492 host_config_.append(buf, len); | 494 host_config_.append(buf, len); |
| 493 } | 495 } |
| 494 } | 496 } |
| 495 } else { | 497 } else { |
| 496 base::FilePath default_config_dir = remoting::GetConfigDir(); | 498 base::FilePath default_config_dir = remoting::GetConfigDir(); |
| 497 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile); | 499 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile); |
| 498 } | 500 } |
| 499 | 501 |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1646 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1645 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1647 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
| 1646 | 1648 |
| 1647 // Run the main (also UI) message loop until the host no longer needs it. | 1649 // Run the main (also UI) message loop until the host no longer needs it. |
| 1648 message_loop.Run(); | 1650 message_loop.Run(); |
| 1649 | 1651 |
| 1650 return exit_code; | 1652 return exit_code; |
| 1651 } | 1653 } |
| 1652 | 1654 |
| 1653 } // namespace remoting | 1655 } // namespace remoting |
| OLD | NEW |