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

Side by Side Diff: ipc/ipc_channel_nacl.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_factory.cc ('k') | ipc/ipc_channel_nacl.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_NACL_H_ 5 #ifndef IPC_IPC_CHANNEL_NACL_H_
6 #define IPC_IPC_CHANNEL_NACL_H_ 6 #define IPC_IPC_CHANNEL_NACL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 17 matching lines...) Expand all
28 // NaClDescCustom. See NaClIPCAdapter for the trusted-side implementation. 28 // NaClDescCustom. See NaClIPCAdapter for the trusted-side implementation.
29 // 29 //
30 // We don't need to worry about complicated set up and READWRITE mode for 30 // We don't need to worry about complicated set up and READWRITE mode for
31 // sharing handles. We also currently do not support passing file descriptors or 31 // sharing handles. We also currently do not support passing file descriptors or
32 // named pipes, and we use background threads to emulate signaling when we can 32 // named pipes, and we use background threads to emulate signaling when we can
33 // read or write without blocking. 33 // read or write without blocking.
34 class ChannelNacl : public Channel, 34 class ChannelNacl : public Channel,
35 public internal::ChannelReader { 35 public internal::ChannelReader {
36 public: 36 public:
37 // Mirror methods of Channel, see ipc_channel.h for description. 37 // Mirror methods of Channel, see ipc_channel.h for description.
38 // |broker| must outlive the newly created object.
38 ChannelNacl(const IPC::ChannelHandle& channel_handle, 39 ChannelNacl(const IPC::ChannelHandle& channel_handle,
39 Mode mode, 40 Mode mode,
40 Listener* listener); 41 Listener* listener,
42 AttachmentBroker* broker);
41 ~ChannelNacl() override; 43 ~ChannelNacl() override;
42 44
43 // Channel implementation. 45 // Channel implementation.
44 base::ProcessId GetPeerPID() const override; 46 base::ProcessId GetPeerPID() const override;
45 base::ProcessId GetSelfPID() const override; 47 base::ProcessId GetSelfPID() const override;
46 bool Connect() override; 48 bool Connect() override;
47 void Close() override; 49 void Close() override;
48 bool Send(Message* message) override; 50 bool Send(Message* message) override;
51 AttachmentBroker* GetAttachmentBroker() override;
49 52
50 // Posted to the main thread by ReaderThreadRunner. 53 // Posted to the main thread by ReaderThreadRunner.
51 void DidRecvMsg(scoped_ptr<MessageContents> contents); 54 void DidRecvMsg(scoped_ptr<MessageContents> contents);
52 void ReadDidFail(); 55 void ReadDidFail();
53 56
54 private: 57 private:
55 class ReaderThreadRunner; 58 class ReaderThreadRunner;
56 59
57 bool CreatePipe(const IPC::ChannelHandle& channel_handle); 60 bool CreatePipe(const IPC::ChannelHandle& channel_handle);
58 bool ProcessOutgoingMessages(); 61 bool ProcessOutgoingMessages();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // don't change to something like std::deque<> without changing the 110 // don't change to something like std::deque<> without changing the
108 // implementation! 111 // implementation!
109 std::vector<int> input_fds_; 112 std::vector<int> input_fds_;
110 113
111 // This queue is used when a message is sent prior to Connect having been 114 // This queue is used when a message is sent prior to Connect having been
112 // called. Normally after we're connected, the queue is empty. 115 // called. Normally after we're connected, the queue is empty.
113 std::deque<linked_ptr<Message> > output_queue_; 116 std::deque<linked_ptr<Message> > output_queue_;
114 117
115 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_; 118 base::WeakPtrFactory<ChannelNacl> weak_ptr_factory_;
116 119
120 // |broker_| must outlive this instance.
121 AttachmentBroker* broker_;
122
117 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl); 123 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelNacl);
118 }; 124 };
119 125
120 } // namespace IPC 126 } // namespace IPC
121 127
122 #endif // IPC_IPC_CHANNEL_NACL_H_ 128 #endif // IPC_IPC_CHANNEL_NACL_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_factory.cc ('k') | ipc/ipc_channel_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698