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

Side by Side Diff: base/memory/shared_memory_handle.h

Issue 1643253003: Add member ownership_passes_to_ipc_ to SharedMemoryHandle on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minimal test. Created 4 years, 10 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 | base/memory/shared_memory_handle_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ 5 #ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ 6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Whether the underlying OS primitive is valid. 57 // Whether the underlying OS primitive is valid.
58 bool IsValid() const; 58 bool IsValid() const;
59 59
60 // Whether |pid_| is the same as the current process's id. 60 // Whether |pid_| is the same as the current process's id.
61 bool BelongsToCurrentProcess() const; 61 bool BelongsToCurrentProcess() const;
62 62
63 // Whether handle_ needs to be duplicated into the destination process when 63 // Whether handle_ needs to be duplicated into the destination process when
64 // an instance of this class is passed over a Chrome IPC channel. 64 // an instance of this class is passed over a Chrome IPC channel.
65 bool NeedsBrokering() const; 65 bool NeedsBrokering() const;
66 66
67 void SetOwnershipPassesToIPC(bool ownership_passes);
68 bool OwnershipPassesToIPC() const;
69
67 HANDLE GetHandle() const; 70 HANDLE GetHandle() const;
68 base::ProcessId GetPID() const; 71 base::ProcessId GetPID() const;
69 72
70 private: 73 private:
71 HANDLE handle_; 74 HANDLE handle_;
72 75
73 // The process in which |handle_| is valid and can be used. If |handle_| is 76 // The process in which |handle_| is valid and can be used. If |handle_| is
74 // invalid, this will be kNullProcessId. 77 // invalid, this will be kNullProcessId.
75 base::ProcessId pid_; 78 base::ProcessId pid_;
79
80 // Whether passing this object as a parameter to an IPC message passes
81 // ownership of |handle_| to the IPC stack. This is meant to mimic the
82 // behavior of the |auto_close| parameter of FileDescriptor. This member only
83 // affects attachment-brokered SharedMemoryHandles.
84 // Defaults to |false|.
85 bool ownership_passes_to_ipc_;
76 }; 86 };
77 #else 87 #else
78 class BASE_EXPORT SharedMemoryHandle { 88 class BASE_EXPORT SharedMemoryHandle {
79 public: 89 public:
80 // The values of these enums must not change, as they are used by the 90 // The values of these enums must not change, as they are used by the
81 // histogram OSX.SharedMemory.Mechanism. 91 // histogram OSX.SharedMemory.Mechanism.
82 enum Type { 92 enum Type {
83 // The SharedMemoryHandle is backed by a POSIX fd. 93 // The SharedMemoryHandle is backed by a POSIX fd.
84 POSIX, 94 POSIX,
85 // The SharedMemoryHandle is backed by the Mach primitive "memory object". 95 // The SharedMemoryHandle is backed by the Mach primitive "memory object".
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Defaults to |false|. 202 // Defaults to |false|.
193 bool ownership_passes_to_ipc_; 203 bool ownership_passes_to_ipc_;
194 }; 204 };
195 }; 205 };
196 }; 206 };
197 #endif 207 #endif
198 208
199 } // namespace base 209 } // namespace base
200 210
201 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ 211 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_handle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698