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

Unified Diff: ipc/handle_attachment_win.h

Issue 1493413004: ipc: Allow attachment brokering for shared memory handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp1
Patch Set: Fix more tests. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/attachment_broker_unprivileged_win_unittest.cc ('k') | ipc/handle_attachment_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/handle_attachment_win.h
diff --git a/ipc/handle_attachment_win.h b/ipc/handle_attachment_win.h
index 35807b4da908ecc92ad21615bd2b7b6cfb9c13d3..5e04bdb36266a90e792476d66c3c99fc3be15653 100644
--- a/ipc/handle_attachment_win.h
+++ b/ipc/handle_attachment_win.h
@@ -58,10 +58,9 @@ class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment {
// result. Should only be called by the sender of a Chrome IPC message.
HandleAttachmentWin(const HANDLE& handle, HandleWin::Permissions permissions);
- // These constructors do not take ownership of the HANDLE, and should only be
- // called by the receiver of a Chrome IPC message.
+ // This constructor takes ownership of |wire_format.handle| without making a
+ // copy. Should only be called by the receiver of a Chrome IPC message.
explicit HandleAttachmentWin(const WireFormat& wire_format);
- explicit HandleAttachmentWin(const BrokerableAttachment::AttachmentId& id);
BrokerableType GetBrokerableType() const override;
@@ -71,7 +70,10 @@ class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment {
HANDLE get_handle() const { return handle_; }
// The caller of this method has taken ownership of |handle_|.
- void reset_handle_ownership() { owns_handle_ = false; }
+ void reset_handle_ownership() {
+ owns_handle_ = false;
+ handle_ = INVALID_HANDLE_VALUE;
+ }
private:
~HandleAttachmentWin() override;
@@ -81,9 +83,8 @@ class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment {
// In the sender process, the attachment owns the HANDLE of a newly created
// message. The attachment broker will eventually take ownership, and set
// this member to |false|.
- // In the destination process, the attachment never owns the Mach port. The
- // client code that receives the Chrome IPC message is always expected to take
- // ownership.
+ // In the destination process, the attachment owns the Mach port until a call
+ // to ParamTraits<HandleWin>::Read() takes ownership.
bool owns_handle_;
};
« no previous file with comments | « ipc/attachment_broker_unprivileged_win_unittest.cc ('k') | ipc/handle_attachment_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698