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

Side by Side Diff: ipc/handle_attachment_win.cc

Issue 2504063002: Revert of Remove IPC::BrokerableAttachment. (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 | « ipc/handle_attachment_win.h ('k') | ipc/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 #include "ipc/handle_attachment_win.h" 5 #include "ipc/handle_attachment_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 namespace IPC { 9 namespace IPC {
10 namespace internal { 10 namespace internal {
(...skipping 10 matching lines...) Expand all
21 if (result) { 21 if (result) {
22 handle_ = duplicated_handle; 22 handle_ = duplicated_handle;
23 permissions_ = permissions; 23 permissions_ = permissions;
24 } 24 }
25 } 25 }
26 26
27 HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle, 27 HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle,
28 FromWire from_wire) 28 FromWire from_wire)
29 : handle_(handle), permissions_(HandleWin::INVALID), owns_handle_(true) {} 29 : handle_(handle), permissions_(HandleWin::INVALID), owns_handle_(true) {}
30 30
31 HandleAttachmentWin::HandleAttachmentWin(const WireFormat& wire_format)
32 : handle_(LongToHandle(wire_format.handle)),
33 permissions_(wire_format.permissions),
34 owns_handle_(true) {}
35
31 HandleAttachmentWin::~HandleAttachmentWin() { 36 HandleAttachmentWin::~HandleAttachmentWin() {
32 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_) 37 if (handle_ != INVALID_HANDLE_VALUE && owns_handle_)
33 ::CloseHandle(handle_); 38 ::CloseHandle(handle_);
34 } 39 }
35 40
36 MessageAttachment::Type HandleAttachmentWin::GetType() const { 41 HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType()
37 return Type::WIN_HANDLE; 42 const {
43 return WIN_HANDLE;
44 }
45
46 HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat(
47 const base::ProcessId& destination) const {
48 return WireFormat(HandleToLong(handle_), destination, permissions_);
38 } 49 }
39 50
40 } // namespace internal 51 } // namespace internal
41 } // namespace IPC 52 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/handle_attachment_win.h ('k') | ipc/handle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698