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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 310853003: Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_sync_channel.h » ('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 #include "ipc/ipc_channel_proxy.h" 5 #include "ipc/ipc_channel_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 // Called on the listener's thread 299 // Called on the listener's thread
300 void ChannelProxy::Context::OnDispatchBadMessage(const Message& message) { 300 void ChannelProxy::Context::OnDispatchBadMessage(const Message& message) {
301 if (listener_) 301 if (listener_)
302 listener_->OnBadMessageReceived(message); 302 listener_->OnBadMessageReceived(message);
303 } 303 }
304 304
305 //----------------------------------------------------------------------------- 305 //-----------------------------------------------------------------------------
306 306
307 ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, 307 // static
308 Channel::Mode mode, 308 scoped_ptr<ChannelProxy> ChannelProxy::Create(
309 Listener* listener, 309 const IPC::ChannelHandle& channel_handle,
310 base::SingleThreadTaskRunner* ipc_task_runner) 310 Channel::Mode mode,
311 : context_(new Context(listener, ipc_task_runner)), 311 Listener* listener,
312 did_init_(false) { 312 base::SingleThreadTaskRunner* ipc_task_runner) {
313 Init(channel_handle, mode, true); 313 scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner));
314 channel->Init(channel_handle, mode, true);
315 return channel.Pass();
314 } 316 }
315 317
316 ChannelProxy::ChannelProxy(Context* context) 318 ChannelProxy::ChannelProxy(Context* context)
317 : context_(context), 319 : context_(context),
318 did_init_(false) { 320 did_init_(false) {
319 } 321 }
320 322
323 ChannelProxy::ChannelProxy(Listener* listener,
324 base::SingleThreadTaskRunner* ipc_task_runner)
325 : context_(new Context(listener, ipc_task_runner)), did_init_(false) {
326 }
327
321 ChannelProxy::~ChannelProxy() { 328 ChannelProxy::~ChannelProxy() {
322 DCHECK(CalledOnValidThread()); 329 DCHECK(CalledOnValidThread());
323 330
324 Close(); 331 Close();
325 } 332 }
326 333
327 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle, 334 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
328 Channel::Mode mode, 335 Channel::Mode mode,
329 bool create_pipe_now) { 336 bool create_pipe_now) {
330 DCHECK(CalledOnValidThread()); 337 DCHECK(CalledOnValidThread());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 Channel* channel = context_.get()->channel_.get(); 443 Channel* channel = context_.get()->channel_.get();
437 // Channel must have been created first. 444 // Channel must have been created first.
438 DCHECK(channel) << context_.get()->channel_id_; 445 DCHECK(channel) << context_.get()->channel_id_;
439 return channel->GetPeerEuid(peer_euid); 446 return channel->GetPeerEuid(peer_euid);
440 } 447 }
441 #endif 448 #endif
442 449
443 //----------------------------------------------------------------------------- 450 //-----------------------------------------------------------------------------
444 451
445 } // namespace IPC 452 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_sync_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698