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

Side by Side Diff: mojo/edk/embedder/named_platform_handle_utils_win.cc

Issue 2466433002: Add mojo::edk::ClosePeerConnection. (Closed)
Patch Set: Created 4 years, 1 month 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 | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/system/core.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 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_handle_utils.h" 5 #include "mojo/edk/embedder/named_platform_handle_utils.h"
6 6
7 #include <sddl.h> 7 #include <sddl.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const DWORD kDesiredAccess = GENERIC_READ | GENERIC_WRITE; 42 const DWORD kDesiredAccess = GENERIC_READ | GENERIC_WRITE;
43 // The SECURITY_ANONYMOUS flag means that the server side cannot impersonate 43 // The SECURITY_ANONYMOUS flag means that the server side cannot impersonate
44 // the client. 44 // the client.
45 const DWORD kFlags = 45 const DWORD kFlags =
46 SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS | FILE_FLAG_OVERLAPPED; 46 SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS | FILE_FLAG_OVERLAPPED;
47 ScopedPlatformHandle handle( 47 ScopedPlatformHandle handle(
48 PlatformHandle(CreateFileW(pipe_name.c_str(), kDesiredAccess, 48 PlatformHandle(CreateFileW(pipe_name.c_str(), kDesiredAccess,
49 0, // No sharing. 49 0, // No sharing.
50 nullptr, OPEN_EXISTING, kFlags, 50 nullptr, OPEN_EXISTING, kFlags,
51 nullptr))); // No template file. 51 nullptr))); // No template file.
52 PCHECK(handle.is_valid()); 52 // The server may have stopped accepting a connection between the
53 // WaitNamedPipe() and CreateFile(). If this occurs, an invalid handle is
54 // returned.
55 DPLOG_IF(ERROR, !handle.is_valid())
56 << "Named pipe " << named_handle.pipe_name()
57 << " could not be opened after WaitNamedPipe succeeded";
53 return handle; 58 return handle;
54 } 59 }
55 60
56 ScopedPlatformHandle CreateServerHandle( 61 ScopedPlatformHandle CreateServerHandle(
57 const NamedPlatformHandle& named_handle, 62 const NamedPlatformHandle& named_handle,
58 const CreateServerHandleOptions& options) { 63 const CreateServerHandleOptions& options) {
59 if (!named_handle.is_valid()) 64 if (!named_handle.is_valid())
60 return ScopedPlatformHandle(); 65 return ScopedPlatformHandle();
61 66
62 PSECURITY_DESCRIPTOR security_desc = nullptr; 67 PSECURITY_DESCRIPTOR security_desc = nullptr;
(...skipping 18 matching lines...) Expand all
81 4096, // Out buffer size. 86 4096, // Out buffer size.
82 4096, // In buffer size. 87 4096, // In buffer size.
83 5000, // Timeout in milliseconds. 88 5000, // Timeout in milliseconds.
84 &security_attributes)); 89 &security_attributes));
85 handle.needs_connection = true; 90 handle.needs_connection = true;
86 return ScopedPlatformHandle(handle); 91 return ScopedPlatformHandle(handle);
87 } 92 }
88 93
89 } // namespace edk 94 } // namespace edk
90 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/system/core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698