Skip to content

Commit

Permalink
Manual fixups for scoped_refptr operator T* removal in ipc/
Browse files Browse the repository at this point in the history
BUG=110610

Review URL: https://codereview.chromium.org/512153002

Cr-Commit-Position: refs/heads/master@{#292404}
  • Loading branch information
zetafunction authored and Commit bot committed Aug 28, 2014
1 parent 4389043 commit fd03370
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
14 changes: 8 additions & 6 deletions ipc/ipc_channel_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ namespace IPC {

//------------------------------------------------------------------------------

ChannelProxy::Context::Context(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner)
ChannelProxy::Context::Context(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
: listener_task_runner_(base::ThreadTaskRunnerHandle::Get()),
listener_(listener),
ipc_task_runner_(ipc_task_runner),
Expand Down Expand Up @@ -309,7 +310,7 @@ scoped_ptr<ChannelProxy> ChannelProxy::Create(
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner) {
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner));
channel->Init(channel_handle, mode, true);
return channel.Pass();
Expand All @@ -319,7 +320,7 @@ scoped_ptr<ChannelProxy> ChannelProxy::Create(
scoped_ptr<ChannelProxy> ChannelProxy::Create(
scoped_ptr<ChannelFactory> factory,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner) {
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner));
channel->Init(factory.Pass(), true);
return channel.Pass();
Expand All @@ -330,8 +331,9 @@ ChannelProxy::ChannelProxy(Context* context)
did_init_(false) {
}

ChannelProxy::ChannelProxy(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner)
ChannelProxy::ChannelProxy(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
: context_(new Context(listener, ipc_task_runner)), did_init_(false) {
}

Expand Down
12 changes: 7 additions & 5 deletions ipc/ipc_channel_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner);
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);

static scoped_ptr<ChannelProxy> Create(
scoped_ptr<ChannelFactory> factory,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner);
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);

virtual ~ChannelProxy();

Expand Down Expand Up @@ -131,14 +131,16 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
// to the internal state.
ChannelProxy(Context* context);

ChannelProxy(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner);
ChannelProxy(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner);

// Used internally to hold state that is referenced on the IPC thread.
class Context : public base::RefCountedThreadSafe<Context>,
public Listener {
public:
Context(Listener* listener, base::SingleThreadTaskRunner* ipc_thread);
Context(Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread);
void ClearIPCTaskRunner();
base::SingleThreadTaskRunner* ipc_task_runner() const {
return ipc_task_runner_.get();
Expand Down
10 changes: 5 additions & 5 deletions ipc/ipc_sync_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> >

SyncChannel::SyncContext::SyncContext(
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
WaitableEvent* shutdown_event)
: ChannelProxy::Context(listener, ipc_task_runner),
received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()),
Expand Down Expand Up @@ -410,7 +410,7 @@ scoped_ptr<SyncChannel> SyncChannel::Create(
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
bool create_pipe_now,
base::WaitableEvent* shutdown_event) {
scoped_ptr<SyncChannel> channel =
Expand All @@ -423,7 +423,7 @@ scoped_ptr<SyncChannel> SyncChannel::Create(
scoped_ptr<SyncChannel> SyncChannel::Create(
scoped_ptr<ChannelFactory> factory,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
bool create_pipe_now,
base::WaitableEvent* shutdown_event) {
scoped_ptr<SyncChannel> channel =
Expand All @@ -435,15 +435,15 @@ scoped_ptr<SyncChannel> SyncChannel::Create(
// static
scoped_ptr<SyncChannel> SyncChannel::Create(
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
WaitableEvent* shutdown_event) {
return make_scoped_ptr(
new SyncChannel(listener, ipc_task_runner, shutdown_event));
}

SyncChannel::SyncChannel(
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
WaitableEvent* shutdown_event)
: ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) {
// The current (listener) thread must be distinct from the IPC thread, or else
Expand Down
20 changes: 11 additions & 9 deletions ipc/ipc_sync_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
const IPC::ChannelHandle& channel_handle,
IPC::Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
bool create_pipe_now,
base::WaitableEvent* shutdown_event);

static scoped_ptr<SyncChannel> Create(
scoped_ptr<ChannelFactory> factory,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
bool create_pipe_now,
base::WaitableEvent* shutdown_event);

Expand All @@ -88,7 +88,7 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
// added before any messages are sent or received.
static scoped_ptr<SyncChannel> Create(
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
base::WaitableEvent* shutdown_event);

virtual ~SyncChannel();
Expand Down Expand Up @@ -121,9 +121,10 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
// ChannelProxy::Context for more information.
class SyncContext : public Context {
public:
SyncContext(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event);
SyncContext(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
base::WaitableEvent* shutdown_event);

// Adds information about an outgoing sync message to the context so that
// we know how to deserialize the reply.
Expand Down Expand Up @@ -199,9 +200,10 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
};

private:
SyncChannel(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event);
SyncChannel(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
base::WaitableEvent* shutdown_event);

void OnWaitableEventSignaled(base::WaitableEvent* arg);

Expand Down

0 comments on commit fd03370

Please sign in to comment.