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

Side by Side Diff: ipc/ipc_channel_proxy.h

Issue 666493005: Standardize usage of virtual/override/final in ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_posix_unittest.cc ('k') | ipc/ipc_channel_proxy_unittest.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_PROXY_H_ 5 #ifndef IPC_IPC_CHANNEL_PROXY_H_
6 #define IPC_IPC_CHANNEL_PROXY_H_ 6 #define IPC_IPC_CHANNEL_PROXY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const IPC::ChannelHandle& channel_handle, 69 const IPC::ChannelHandle& channel_handle,
70 Channel::Mode mode, 70 Channel::Mode mode,
71 Listener* listener, 71 Listener* listener,
72 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); 72 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);
73 73
74 static scoped_ptr<ChannelProxy> Create( 74 static scoped_ptr<ChannelProxy> Create(
75 scoped_ptr<ChannelFactory> factory, 75 scoped_ptr<ChannelFactory> factory,
76 Listener* listener, 76 Listener* listener,
77 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); 77 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);
78 78
79 virtual ~ChannelProxy(); 79 ~ChannelProxy() override;
80 80
81 // Initializes the channel proxy. Only call this once to initialize a channel 81 // Initializes the channel proxy. Only call this once to initialize a channel
82 // proxy that was not initialized in its constructor. If create_pipe_now is 82 // proxy that was not initialized in its constructor. If create_pipe_now is
83 // true, the pipe is created synchronously. Otherwise it's created on the IO 83 // true, the pipe is created synchronously. Otherwise it's created on the IO
84 // thread. 84 // thread.
85 void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, 85 void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode,
86 bool create_pipe_now); 86 bool create_pipe_now);
87 void Init(scoped_ptr<ChannelFactory> factory, bool create_pipe_now); 87 void Init(scoped_ptr<ChannelFactory> factory, bool create_pipe_now);
88 88
89 // Close the IPC::Channel. This operation completes asynchronously, once the 89 // Close the IPC::Channel. This operation completes asynchronously, once the
90 // background thread processes the command to close the channel. It is ok to 90 // background thread processes the command to close the channel. It is ok to
91 // call this method multiple times. Redundant calls are ignored. 91 // call this method multiple times. Redundant calls are ignored.
92 // 92 //
93 // WARNING: MessageFilter objects held by the ChannelProxy is also 93 // WARNING: MessageFilter objects held by the ChannelProxy is also
94 // released asynchronously, and it may in fact have its final reference 94 // released asynchronously, and it may in fact have its final reference
95 // released on the background thread. The caller should be careful to deal 95 // released on the background thread. The caller should be careful to deal
96 // with / allow for this possibility. 96 // with / allow for this possibility.
97 void Close(); 97 void Close();
98 98
99 // Send a message asynchronously. The message is routed to the background 99 // Send a message asynchronously. The message is routed to the background
100 // thread where it is passed to the IPC::Channel's Send method. 100 // thread where it is passed to the IPC::Channel's Send method.
101 virtual bool Send(Message* message) override; 101 bool Send(Message* message) override;
102 102
103 // Used to intercept messages as they are received on the background thread. 103 // Used to intercept messages as they are received on the background thread.
104 // 104 //
105 // Ordinarily, messages sent to the ChannelProxy are routed to the matching 105 // Ordinarily, messages sent to the ChannelProxy are routed to the matching
106 // listener on the worker thread. This API allows code to intercept messages 106 // listener on the worker thread. This API allows code to intercept messages
107 // before they are sent to the worker thread. 107 // before they are sent to the worker thread.
108 // If you call this before the target process is launched, then you're 108 // If you call this before the target process is launched, then you're
109 // guaranteed to not miss any messages. But if you call this anytime after, 109 // guaranteed to not miss any messages. But if you call this anytime after,
110 // then some messages might be missed since the filter is added internally on 110 // then some messages might be missed since the filter is added internally on
111 // the IO thread. 111 // the IO thread.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 base::SingleThreadTaskRunner* ipc_task_runner() const { 145 base::SingleThreadTaskRunner* ipc_task_runner() const {
146 return ipc_task_runner_.get(); 146 return ipc_task_runner_.get();
147 } 147 }
148 const std::string& channel_id() const { return channel_id_; } 148 const std::string& channel_id() const { return channel_id_; }
149 149
150 // Dispatches a message on the listener thread. 150 // Dispatches a message on the listener thread.
151 void OnDispatchMessage(const Message& message); 151 void OnDispatchMessage(const Message& message);
152 152
153 protected: 153 protected:
154 friend class base::RefCountedThreadSafe<Context>; 154 friend class base::RefCountedThreadSafe<Context>;
155 virtual ~Context(); 155 ~Context() override;
156 156
157 // IPC::Listener methods: 157 // IPC::Listener methods:
158 virtual bool OnMessageReceived(const Message& message) override; 158 bool OnMessageReceived(const Message& message) override;
159 virtual void OnChannelConnected(int32 peer_pid) override; 159 void OnChannelConnected(int32 peer_pid) override;
160 virtual void OnChannelError() override; 160 void OnChannelError() override;
161 161
162 // Like OnMessageReceived but doesn't try the filters. 162 // Like OnMessageReceived but doesn't try the filters.
163 bool OnMessageReceivedNoFilter(const Message& message); 163 bool OnMessageReceivedNoFilter(const Message& message);
164 164
165 // Gives the filters a chance at processing |message|. 165 // Gives the filters a chance at processing |message|.
166 // Returns true if the message was processed, false otherwise. 166 // Returns true if the message was processed, false otherwise.
167 bool TryFilters(const Message& message); 167 bool TryFilters(const Message& message);
168 168
169 // Like Open and Close, but called on the IPC thread. 169 // Like Open and Close, but called on the IPC thread.
170 virtual void OnChannelOpened(); 170 virtual void OnChannelOpened();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // that involves this data. 232 // that involves this data.
233 scoped_refptr<Context> context_; 233 scoped_refptr<Context> context_;
234 234
235 // Whether the channel has been initialized. 235 // Whether the channel has been initialized.
236 bool did_init_; 236 bool did_init_;
237 }; 237 };
238 238
239 } // namespace IPC 239 } // namespace IPC
240 240
241 #endif // IPC_IPC_CHANNEL_PROXY_H_ 241 #endif // IPC_IPC_CHANNEL_PROXY_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix_unittest.cc ('k') | ipc/ipc_channel_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698