Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "remoting/host/ipc_util.h" | 5 #include "remoting/host/ipc_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 // Create the server end of the channel. | 53 // Create the server end of the channel. |
| 54 ScopedHandle pipe; | 54 ScopedHandle pipe; |
| 55 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { | 55 if (!CreateIpcChannel(channel_name, security_descriptor, &pipe)) { |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Wrap the pipe into an IPC channel. | 59 // Wrap the pipe into an IPC channel. |
| 60 std::unique_ptr<IPC::ChannelProxy> server( | 60 std::unique_ptr<IPC::ChannelProxy> server( |
| 61 new IPC::ChannelProxy(listener, io_task_runner)); | 61 new IPC::ChannelProxy(listener, io_task_runner)); |
| 62 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 62 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); |
| 63 server.get(), io_task_runner); | 63 if (!broker) { |
| 64 LOG(WARNING) << "No AttachmentBroker registered."; | |
|
erikchen
2016/04/28 23:12:50
Every process should have a broker. When does this
joedow
2016/04/28 23:20:49
It occurred after you made your last change and I
erikchen
2016/04/28 23:24:54
Would making this a DCHECK(broker) or even a CHECK
joedow
2016/04/28 23:39:26
DCHECK sounds legit.
| |
| 65 } else if (broker->IsPrivilegedBroker()) { | |
| 66 broker->RegisterCommunicationChannel(server.get(), io_task_runner); | |
| 67 } | |
| 64 server->Init(IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, | 68 server->Init(IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, |
| 65 true); | 69 /*create_pipe_now=*/true); |
| 66 | 70 |
| 67 // Convert the channel name to the pipe name. | 71 // Convert the channel name to the pipe name. |
| 68 std::string pipe_name(kChromePipeNamePrefix); | 72 std::string pipe_name(kChromePipeNamePrefix); |
| 69 pipe_name.append(channel_name); | 73 pipe_name.append(channel_name); |
| 70 | 74 |
| 71 SECURITY_ATTRIBUTES security_attributes = {0}; | 75 SECURITY_ATTRIBUTES security_attributes = {0}; |
| 72 security_attributes.nLength = sizeof(security_attributes); | 76 security_attributes.nLength = sizeof(security_attributes); |
| 73 security_attributes.lpSecurityDescriptor = nullptr; | 77 security_attributes.lpSecurityDescriptor = nullptr; |
| 74 security_attributes.bInheritHandle = TRUE; | 78 security_attributes.bInheritHandle = TRUE; |
| 75 | 79 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 PLOG(ERROR) | 134 PLOG(ERROR) |
| 131 << "Failed to create the server end of the Chromoting IPC channel"; | 135 << "Failed to create the server end of the Chromoting IPC channel"; |
| 132 return false; | 136 return false; |
| 133 } | 137 } |
| 134 | 138 |
| 135 *pipe_out = std::move(pipe); | 139 *pipe_out = std::move(pipe); |
| 136 return true; | 140 return true; |
| 137 } | 141 } |
| 138 | 142 |
| 139 } // namespace remoting | 143 } // namespace remoting |
| OLD | NEW |