OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/edk/embedder/named_platform_channel_pair.h" | 5 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 const char kMojoNamedPlatformChannelPipeSwitch[] = | 28 const char kMojoNamedPlatformChannelPipeSwitch[] = |
29 "mojo-named-platform-channel-pipe"; | 29 "mojo-named-platform-channel-pipe"; |
30 | 30 |
31 std::wstring GeneratePipeName() { | 31 std::wstring GeneratePipeName() { |
32 return base::StringPrintf(L"%u.%u.%I64u", GetCurrentProcessId(), | 32 return base::StringPrintf(L"%u.%u.%I64u", GetCurrentProcessId(), |
33 GetCurrentThreadId(), base::RandUint64()); | 33 GetCurrentThreadId(), base::RandUint64()); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 NamedPlatformChannelPair::NamedPlatformChannelPair() | 38 NamedPlatformChannelPair::NamedPlatformChannelPair( |
| 39 const NamedPlatformChannelPair::Options& options) |
39 : pipe_handle_(GeneratePipeName()) { | 40 : pipe_handle_(GeneratePipeName()) { |
40 server_handle_ = CreateServerHandle(pipe_handle_, true); | 41 CreateServerHandleOptions server_handle_options; |
| 42 server_handle_options.security_descriptor = options.security_descriptor; |
| 43 server_handle_options.enforce_uniqueness = true; |
| 44 server_handle_ = CreateServerHandle(pipe_handle_, server_handle_options); |
41 PCHECK(server_handle_.is_valid()); | 45 PCHECK(server_handle_.is_valid()); |
42 } | 46 } |
43 | 47 |
44 NamedPlatformChannelPair::~NamedPlatformChannelPair() {} | 48 NamedPlatformChannelPair::~NamedPlatformChannelPair() {} |
45 | 49 |
46 ScopedPlatformHandle NamedPlatformChannelPair::PassServerHandle() { | 50 ScopedPlatformHandle NamedPlatformChannelPair::PassServerHandle() { |
47 return std::move(server_handle_); | 51 return std::move(server_handle_); |
48 } | 52 } |
49 | 53 |
50 // static | 54 // static |
(...skipping 25 matching lines...) Expand all Loading... |
76 << command_line->GetSwitchValueNative( | 80 << command_line->GetSwitchValueNative( |
77 kMojoNamedPlatformChannelPipeSwitch); | 81 kMojoNamedPlatformChannelPipeSwitch); |
78 // (Any existing switch won't actually be removed from the command line, but | 82 // (Any existing switch won't actually be removed from the command line, but |
79 // the last one appended takes precedence.) | 83 // the last one appended takes precedence.) |
80 command_line->AppendSwitchNative(kMojoNamedPlatformChannelPipeSwitch, | 84 command_line->AppendSwitchNative(kMojoNamedPlatformChannelPipeSwitch, |
81 pipe_handle_.name); | 85 pipe_handle_.name); |
82 } | 86 } |
83 | 87 |
84 } // namespace edk | 88 } // namespace edk |
85 } // namespace mojo | 89 } // namespace mojo |
OLD | NEW |