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

Side by Side Diff: ipc/ipc_channel_win.h

Issue 1185133006: IPC: Make ChannelReader inherit from SupportsAttachmentBrokering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. 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
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_channel_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 (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 <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/win/scoped_handle.h" 16 #include "base/win/scoped_handle.h"
17 #include "ipc/ipc_channel_reader.h" 17 #include "ipc/ipc_channel_reader.h"
18 18
19 namespace base { 19 namespace base {
20 class ThreadChecker; 20 class ThreadChecker;
21 } 21 }
22 22
23 namespace IPC { 23 namespace IPC {
24 24
25 class ChannelWin : public Channel, 25 class ChannelWin : public Channel,
26 public internal::ChannelReader, 26 public internal::ChannelReader,
27 public base::MessageLoopForIO::IOHandler { 27 public base::MessageLoopForIO::IOHandler {
28 public: 28 public:
29 // Mirror methods of Channel, see ipc_channel.h for description. 29 // Mirror methods of Channel, see ipc_channel.h for description.
30 ChannelWin(const IPC::ChannelHandle &channel_handle, Mode mode, 30 // |broker| must outlive the newly created object.
31 Listener* listener); 31 ChannelWin(const IPC::ChannelHandle& channel_handle,
32 Mode mode,
33 Listener* listener,
34 AttachmentBroker* broker);
32 ~ChannelWin() override; 35 ~ChannelWin() override;
33 36
34 // Channel implementation 37 // Channel implementation
35 bool Connect() override; 38 bool Connect() override;
36 void Close() override; 39 void Close() override;
37 bool Send(Message* message) override; 40 bool Send(Message* message) override;
41 AttachmentBroker* GetAttachmentBroker() override;
38 base::ProcessId GetPeerPID() const override; 42 base::ProcessId GetPeerPID() const override;
39 base::ProcessId GetSelfPID() const override; 43 base::ProcessId GetSelfPID() const override;
40 44
41 static bool IsNamedServerInitialized(const std::string& channel_id); 45 static bool IsNamedServerInitialized(const std::string& channel_id);
42 46
43 47
44 private: 48 private:
45 // ChannelReader implementation. 49 // ChannelReader implementation.
46 ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override; 50 ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override;
47 bool WillDispatchInputMessage(Message* msg) override; 51 bool WillDispatchInputMessage(Message* msg) override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 101
98 // This is a unique per-channel value used to authenticate the client end of 102 // This is a unique per-channel value used to authenticate the client end of
99 // a connection. If the value is non-zero, the client passes it in the hello 103 // a connection. If the value is non-zero, the client passes it in the hello
100 // and the host validates. (We don't send the zero value fto preserve IPC 104 // and the host validates. (We don't send the zero value fto preserve IPC
101 // compatability with existing clients that don't validate the channel.) 105 // compatability with existing clients that don't validate the channel.)
102 int32 client_secret_; 106 int32 client_secret_;
103 107
104 scoped_ptr<base::ThreadChecker> thread_check_; 108 scoped_ptr<base::ThreadChecker> thread_check_;
105 base::WeakPtrFactory<ChannelWin> weak_factory_; 109 base::WeakPtrFactory<ChannelWin> weak_factory_;
106 110
111 // |broker_| must outlive this instance.
112 AttachmentBroker* broker_;
113
107 DISALLOW_COPY_AND_ASSIGN(ChannelWin); 114 DISALLOW_COPY_AND_ASSIGN(ChannelWin);
108 }; 115 };
109 116
110 } // namespace IPC 117 } // namespace IPC
111 118
112 #endif // IPC_IPC_CHANNEL_WIN_H_ 119 #endif // IPC_IPC_CHANNEL_WIN_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | ipc/ipc_channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698