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

Side by Side Diff: mojo/edk/embedder/platform_handle.h

Issue 1914053003: [mojo-edk] Fix lifetime management of rewritten Windows HANDLEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | mojo/edk/embedder/platform_handle.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 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 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ 5 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
6 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ 6 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "mojo/edk/system/system_impl_export.h" 9 #include "mojo/edk/system/system_impl_export.h"
10 10
11 #if defined(OS_WIN) 11 #if defined(OS_WIN)
12 #include <windows.h> 12 #include <windows.h>
13
14 #include "base/process/process_handle.h"
13 #elif defined(OS_MACOSX) && !defined(OS_IOS) 15 #elif defined(OS_MACOSX) && !defined(OS_IOS)
14 #include <mach/mach.h> 16 #include <mach/mach.h>
15 #endif 17 #endif
16 18
17 namespace mojo { 19 namespace mojo {
18 namespace edk { 20 namespace edk {
19 21
20 #if defined(OS_POSIX) 22 #if defined(OS_POSIX)
21 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { 23 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
22 PlatformHandle() {} 24 PlatformHandle() {}
(...skipping 28 matching lines...) Expand all
51 53
52 int handle = -1; 54 int handle = -1;
53 55
54 #if defined(OS_MACOSX) && !defined(OS_IOS) 56 #if defined(OS_MACOSX) && !defined(OS_IOS)
55 mach_port_t port = MACH_PORT_NULL; 57 mach_port_t port = MACH_PORT_NULL;
56 #endif 58 #endif
57 }; 59 };
58 #elif defined(OS_WIN) 60 #elif defined(OS_WIN)
59 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { 61 struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
60 PlatformHandle() : handle(INVALID_HANDLE_VALUE) {} 62 PlatformHandle() : handle(INVALID_HANDLE_VALUE) {}
61 explicit PlatformHandle(HANDLE handle) : handle(handle) {} 63 explicit PlatformHandle(HANDLE handle)
64 : handle(handle), owning_process(base::GetCurrentProcessHandle()) {}
62 65
63 void CloseIfNecessary(); 66 void CloseIfNecessary();
64 67
65 bool is_valid() const { return handle != INVALID_HANDLE_VALUE; } 68 bool is_valid() const { return handle != INVALID_HANDLE_VALUE; }
66 69
67 HANDLE handle; 70 HANDLE handle;
71
72 // A Windows HANDLE may be duplicated to another process but not yet sent to
73 // that process. This tracks the handle's owning process.
74 base::ProcessHandle owning_process;
68 }; 75 };
69 #else 76 #else
70 #error "Platform not yet supported." 77 #error "Platform not yet supported."
71 #endif 78 #endif
72 79
73 } // namespace edk 80 } // namespace edk
74 } // namespace mojo 81 } // namespace mojo
75 82
76 #endif // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_ 83 #endif // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/embedder/platform_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698