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

Side by Side Diff: ipc/handle_attachment_win.h

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the wireformat to use int32_t for HANDLE. Created 5 years, 6 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
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 IPC_HANDLE_ATTACHMENT_WIN_H_ 5 #ifndef IPC_HANDLE_ATTACHMENT_WIN_H_
6 #define IPC_HANDLE_ATTACHMENT_WIN_H_ 6 #define IPC_HANDLE_ATTACHMENT_WIN_H_
7 7
8 #include <stdint.h>
9
10 #include "base/process/process_handle.h"
8 #include "ipc/brokerable_attachment.h" 11 #include "ipc/brokerable_attachment.h"
9 #include "ipc/ipc_export.h" 12 #include "ipc/ipc_export.h"
10 13
11 namespace IPC { 14 namespace IPC {
12 namespace internal { 15 namespace internal {
13 16
14 // This class represents a Windows HANDLE attached to a Chrome IPC message. 17 // This class represents a Windows HANDLE attached to a Chrome IPC message.
15 class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment { 18 class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment {
19 public:
20 // The wire format for this handle.
21 struct IPC_EXPORT WireFormat {
22 // The HANDLE that is intended for duplication, or the HANDLE that has been
23 // duplicated, depending on context.
24 // The type is int32_t instead of HANDLE because HANDLE gets typedefed to
25 // void*, whose size varies between 32 and 64-bit processes. Using a
26 // int32_t means that 64-bit processes will need to perform both up-casting
27 // and down-casting. This is performed using the appropriate Windows apis.
28 int32_t handle;
29 // The id of the destination process that the handle is duplicated into.
30 base::ProcessId destination_process;
31 AttachmentId attachment_id;
32 };
33
34 HandleAttachmentWin(const HANDLE& handle);
35
36 BrokerableType GetBrokerableType() const override;
37
38 // Returns the wire format of this attachment.
39 WireFormat GetWireFormat(const base::ProcessId& destination) const;
40
16 private: 41 private:
17 Type GetType() const override { return TYPE_WIN_HANDLE; } 42 ~HandleAttachmentWin() override;
18 HANDLE handle_; 43 HANDLE handle_;
19 }; 44 };
20 45
21 } // namespace internal 46 } // namespace internal
22 } // namespace IPC 47 } // namespace IPC
23 48
24 #endif // IPC_HANDLE_ATTACHMENT_WIN_H_ 49 #endif // IPC_HANDLE_ATTACHMENT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698