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

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

Issue 1925263002: Fixing an AttachmentBroker problem which broke the windows host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing the log statement to a DCHECK Created 4 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/ipc_util_win.cc » ('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 the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/desktop_process.h" 8 #include "remoting/host/desktop_process.h"
9 9
10 #include <utility> 10 #include <utility>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 input_task_runner_ = nullptr; 95 input_task_runner_ = nullptr;
96 desktop_environment_factory_.reset(); 96 desktop_environment_factory_.reset();
97 } 97 }
98 98
99 bool DesktopProcess::Start( 99 bool DesktopProcess::Start(
100 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory) { 100 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory) {
101 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 101 DCHECK(caller_task_runner_->BelongsToCurrentThread());
102 DCHECK(!desktop_environment_factory_); 102 DCHECK(!desktop_environment_factory_);
103 DCHECK(desktop_environment_factory); 103 DCHECK(desktop_environment_factory);
104 104
105 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
106
105 desktop_environment_factory_ = std::move(desktop_environment_factory); 107 desktop_environment_factory_ = std::move(desktop_environment_factory);
106 108
107 // Launch the audio capturing thread. 109 // Launch the audio capturing thread.
108 scoped_refptr<AutoThreadTaskRunner> audio_task_runner; 110 scoped_refptr<AutoThreadTaskRunner> audio_task_runner;
109 #if defined(OS_WIN) 111 #if defined(OS_WIN)
110 // On Windows the AudioCapturer requires COM, so we run a single-threaded 112 // On Windows the AudioCapturer requires COM, so we run a single-threaded
111 // apartment, which requires a UI thread. 113 // apartment, which requires a UI thread.
112 audio_task_runner = 114 audio_task_runner =
113 AutoThread::CreateWithLoopAndComInitTypes("ChromotingAudioThread", 115 AutoThread::CreateWithLoopAndComInitTypes("ChromotingAudioThread",
114 caller_task_runner_, 116 caller_task_runner_,
(...skipping 19 matching lines...) Expand all
134 if (!desktop_agent_->Start(AsWeakPtr(), &desktop_pipe)) { 136 if (!desktop_agent_->Start(AsWeakPtr(), &desktop_pipe)) {
135 desktop_agent_ = nullptr; 137 desktop_agent_ = nullptr;
136 caller_task_runner_ = nullptr; 138 caller_task_runner_ = nullptr;
137 input_task_runner_ = nullptr; 139 input_task_runner_ = nullptr;
138 desktop_environment_factory_.reset(); 140 desktop_environment_factory_.reset();
139 return false; 141 return false;
140 } 142 }
141 143
142 // Connect to the daemon. 144 // Connect to the daemon.
143 daemon_channel_.reset(new IPC::ChannelProxy(this, io_task_runner.get())); 145 daemon_channel_.reset(new IPC::ChannelProxy(this, io_task_runner.get()));
144 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
145 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); 146 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
146 if (broker && !broker->IsPrivilegedBroker()) 147 if (broker && !broker->IsPrivilegedBroker()) {
147 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get()); 148 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get());
148 daemon_channel_->Init(daemon_channel_name_, IPC::Channel::MODE_CLIENT, true); 149 }
150 daemon_channel_->Init(daemon_channel_name_, IPC::Channel::MODE_CLIENT,
151 /*create_pipe_now=*/true);
149 152
150 // Pass |desktop_pipe| to the daemon. 153 // Pass |desktop_pipe| to the daemon.
151 daemon_channel_->Send( 154 daemon_channel_->Send(
152 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); 155 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe));
153 156
154 return true; 157 return true;
155 } 158 }
156 159
157 void DesktopProcess::OnCrash(const std::string& function_name, 160 void DesktopProcess::OnCrash(const std::string& function_name,
158 const std::string& file_name, 161 const std::string& file_name,
159 const int& line_number) { 162 const int& line_number) {
160 char message[1024]; 163 char message[1024];
161 base::snprintf(message, sizeof(message), 164 base::snprintf(message, sizeof(message),
162 "Requested by %s at %s, line %d.", 165 "Requested by %s at %s, line %d.",
163 function_name.c_str(), file_name.c_str(), line_number); 166 function_name.c_str(), file_name.c_str(), line_number);
164 base::debug::Alias(message); 167 base::debug::Alias(message);
165 168
166 // The daemon requested us to crash the process. 169 // The daemon requested us to crash the process.
167 CHECK(false) << message; 170 CHECK(false) << message;
168 } 171 }
169 172
170 } // namespace remoting 173 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/ipc_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698