OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_IPC_CHANNEL_WIN_H_ | 5 #ifndef IPC_IPC_CHANNEL_WIN_H_ |
6 #define IPC_IPC_CHANNEL_WIN_H_ | 6 #define IPC_IPC_CHANNEL_WIN_H_ |
7 | 7 |
8 #include "ipc/ipc_channel.h" | 8 #include "ipc/ipc_channel.h" |
9 | 9 |
10 #include <stdint.h> | |
10 #include <queue> | 11 #include <queue> |
Tom Sepez
2015/09/03 19:53:09
nit: blank line between c and c++ headers.
tfarina
2015/09/04 14:01:14
Done.
| |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
16 #include "base/win/scoped_handle.h" | 17 #include "base/win/scoped_handle.h" |
17 #include "ipc/ipc_channel_reader.h" | 18 #include "ipc/ipc_channel_reader.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class ThreadChecker; | 21 class ThreadChecker; |
(...skipping 28 matching lines...) Expand all Loading... | |
49 // ChannelReader implementation. | 50 // ChannelReader implementation. |
50 ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override; | 51 ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override; |
51 bool ShouldDispatchInputMessage(Message* msg) override; | 52 bool ShouldDispatchInputMessage(Message* msg) override; |
52 bool GetNonBrokeredAttachments(Message* msg) override; | 53 bool GetNonBrokeredAttachments(Message* msg) override; |
53 bool DidEmptyInputBuffers() override; | 54 bool DidEmptyInputBuffers() override; |
54 void HandleInternalMessage(const Message& msg) override; | 55 void HandleInternalMessage(const Message& msg) override; |
55 base::ProcessId GetSenderPID() override; | 56 base::ProcessId GetSenderPID() override; |
56 bool IsAttachmentBrokerEndpoint() override; | 57 bool IsAttachmentBrokerEndpoint() override; |
57 | 58 |
58 static const base::string16 PipeName(const std::string& channel_id, | 59 static const base::string16 PipeName(const std::string& channel_id, |
59 int32* secret); | 60 int32_t* secret); |
60 bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); | 61 bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); |
61 | 62 |
62 bool ProcessConnection(); | 63 bool ProcessConnection(); |
63 bool ProcessOutgoingMessages(base::MessageLoopForIO::IOContext* context, | 64 bool ProcessOutgoingMessages(base::MessageLoopForIO::IOContext* context, |
64 DWORD bytes_written); | 65 DWORD bytes_written); |
65 | 66 |
66 // Returns |false| on channel error. | 67 // Returns |false| on channel error. |
67 // If |message| has brokerable attachments, those attachments are passed to | 68 // If |message| has brokerable attachments, those attachments are passed to |
68 // the AttachmentBroker (which in turn invokes Send()), so this method must | 69 // the AttachmentBroker (which in turn invokes Send()), so this method must |
69 // be re-entrant. | 70 // be re-entrant. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 | 115 |
115 // This flag is set when processing incoming messages. It is used to | 116 // This flag is set when processing incoming messages. It is used to |
116 // avoid recursing through ProcessIncomingMessages, which could cause | 117 // avoid recursing through ProcessIncomingMessages, which could cause |
117 // problems. TODO(darin): make this unnecessary | 118 // problems. TODO(darin): make this unnecessary |
118 bool processing_incoming_; | 119 bool processing_incoming_; |
119 | 120 |
120 // Determines if we should validate a client's secret on connection. | 121 // Determines if we should validate a client's secret on connection. |
121 bool validate_client_; | 122 bool validate_client_; |
122 | 123 |
123 // Tracks the lifetime of this object, for debugging purposes. | 124 // Tracks the lifetime of this object, for debugging purposes. |
124 uint32 debug_flags_; | 125 uint32_t debug_flags_; |
125 | 126 |
126 // This is a unique per-channel value used to authenticate the client end of | 127 // This is a unique per-channel value used to authenticate the client end of |
127 // a connection. If the value is non-zero, the client passes it in the hello | 128 // a connection. If the value is non-zero, the client passes it in the hello |
128 // and the host validates. (We don't send the zero value fto preserve IPC | 129 // and the host validates. (We don't send the zero value fto preserve IPC |
129 // compatability with existing clients that don't validate the channel.) | 130 // compatability with existing clients that don't validate the channel.) |
130 int32 client_secret_; | 131 int32_t client_secret_; |
131 | 132 |
132 scoped_ptr<base::ThreadChecker> thread_check_; | 133 scoped_ptr<base::ThreadChecker> thread_check_; |
133 | 134 |
134 // |broker_| must outlive this instance. | 135 // |broker_| must outlive this instance. |
135 AttachmentBroker* broker_; | 136 AttachmentBroker* broker_; |
136 | 137 |
137 base::WeakPtrFactory<ChannelWin> weak_factory_; | 138 base::WeakPtrFactory<ChannelWin> weak_factory_; |
138 DISALLOW_COPY_AND_ASSIGN(ChannelWin); | 139 DISALLOW_COPY_AND_ASSIGN(ChannelWin); |
139 }; | 140 }; |
140 | 141 |
141 } // namespace IPC | 142 } // namespace IPC |
142 | 143 |
143 #endif // IPC_IPC_CHANNEL_WIN_H_ | 144 #endif // IPC_IPC_CHANNEL_WIN_H_ |
OLD | NEW |