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

Side by Side Diff: ipc/ipc_channel_proxy.h

Issue 512153002: Manual fixups for scoped_refptr operator T* removal in ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | ipc/ipc_channel_proxy.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // the thread that creates the ChannelProxy. The filter's OnMessageReceived 62 // the thread that creates the ChannelProxy. The filter's OnMessageReceived
63 // method is called on the thread where the IPC::Channel is running. The 63 // method is called on the thread where the IPC::Channel is running. The
64 // filter may be null if the consumer is not interested in handling messages 64 // filter may be null if the consumer is not interested in handling messages
65 // on the background thread. Any message not handled by the filter will be 65 // on the background thread. Any message not handled by the filter will be
66 // dispatched to the listener. The given task runner correspond to a thread 66 // dispatched to the listener. The given task runner correspond to a thread
67 // on which IPC::Channel is created and used (e.g. IO thread). 67 // on which IPC::Channel is created and used (e.g. IO thread).
68 static scoped_ptr<ChannelProxy> Create( 68 static scoped_ptr<ChannelProxy> Create(
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 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 base::SingleThreadTaskRunner* ipc_task_runner); 77 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);
78 78
79 virtual ~ChannelProxy(); 79 virtual ~ChannelProxy();
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);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 int GetClientFileDescriptor(); 124 int GetClientFileDescriptor();
125 int TakeClientFileDescriptor(); 125 int TakeClientFileDescriptor();
126 #endif // defined(OS_POSIX) 126 #endif // defined(OS_POSIX)
127 127
128 protected: 128 protected:
129 class Context; 129 class Context;
130 // A subclass uses this constructor if it needs to add more information 130 // A subclass uses this constructor if it needs to add more information
131 // to the internal state. 131 // to the internal state.
132 ChannelProxy(Context* context); 132 ChannelProxy(Context* context);
133 133
134 ChannelProxy(Listener* listener, 134 ChannelProxy(
135 base::SingleThreadTaskRunner* ipc_task_runner); 135 Listener* listener,
136 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);
136 137
137 // Used internally to hold state that is referenced on the IPC thread. 138 // Used internally to hold state that is referenced on the IPC thread.
138 class Context : public base::RefCountedThreadSafe<Context>, 139 class Context : public base::RefCountedThreadSafe<Context>,
139 public Listener { 140 public Listener {
140 public: 141 public:
141 Context(Listener* listener, base::SingleThreadTaskRunner* ipc_thread); 142 Context(Listener* listener,
143 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread);
142 void ClearIPCTaskRunner(); 144 void ClearIPCTaskRunner();
143 base::SingleThreadTaskRunner* ipc_task_runner() const { 145 base::SingleThreadTaskRunner* ipc_task_runner() const {
144 return ipc_task_runner_.get(); 146 return ipc_task_runner_.get();
145 } 147 }
146 const std::string& channel_id() const { return channel_id_; } 148 const std::string& channel_id() const { return channel_id_; }
147 149
148 // Dispatches a message on the listener thread. 150 // Dispatches a message on the listener thread.
149 void OnDispatchMessage(const Message& message); 151 void OnDispatchMessage(const Message& message);
150 152
151 protected: 153 protected:
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // that involves this data. 232 // that involves this data.
231 scoped_refptr<Context> context_; 233 scoped_refptr<Context> context_;
232 234
233 // Whether the channel has been initialized. 235 // Whether the channel has been initialized.
234 bool did_init_; 236 bool did_init_;
235 }; 237 };
236 238
237 } // namespace IPC 239 } // namespace IPC
238 240
239 #endif // IPC_IPC_CHANNEL_PROXY_H_ 241 #endif // IPC_IPC_CHANNEL_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698