1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_HANDLE_WIN_H_
6 #define IPC_HANDLE_WIN_H_
12 #include "ipc/ipc_message_support_export.h"
13 #include "ipc/ipc_param_traits.h"
22 // HandleWin is a wrapper around a Windows HANDLE that can be transported
23 // across Chrome IPC channels that support attachment brokering. The HANDLE will
24 // be duplicated into the destination process.
26 // The ownership semantics for the underlying |handle_| are complex. See
27 // ipc/mach_port_mac.h (the OSX analog of this class) for an extensive
29 class IPC_MESSAGE_SUPPORT_EXPORT HandleWin {
31 // Default constructor makes an invalid HANDLE.
33 explicit HandleWin(const HANDLE& handle);
35 HANDLE get_handle() const { return handle_; }
36 void set_handle(HANDLE handle) { handle_ = handle; }
43 struct IPC_MESSAGE_SUPPORT_EXPORT ParamTraits<HandleWin> {
44 typedef HandleWin param_type;
45 static void Write(base::Pickle* m, const param_type& p);
46 static bool Read(const base::Pickle* m,
47 base::PickleIterator* iter,
49 static void Log(const param_type& p, std::string* l);
54 #endif // IPC_HANDLE_WIN_H_