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