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

Side by Side Diff: mojo/system/message_pipe_test_utils.cc

Issue 591573002: Mojo: Remove Channel::AttachMessagePipeEndpoint(). (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 | « mojo/system/message_pipe_dispatcher.cc ('k') | mojo/system/remote_message_pipe_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/system/message_pipe_test_utils.h" 5 #include "mojo/system/message_pipe_test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/platform_thread.h" // For |Sleep()|. 8 #include "base/threading/platform_thread.h" // For |Sleep()|.
9 #include "mojo/system/channel_endpoint.h"
9 #include "mojo/system/waiter.h" 10 #include "mojo/system/waiter.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 namespace system { 13 namespace system {
13 namespace test { 14 namespace test {
14 15
15 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, 16 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp,
16 MojoHandleSignals signals, 17 MojoHandleSignals signals,
17 HandleSignalsState* signals_state) { 18 HandleSignalsState* signals_state) {
18 Waiter waiter; 19 Waiter waiter;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 channel_ = new Channel(platform_support_); 76 channel_ = new Channel(platform_support_);
76 CHECK(channel_->Init(RawChannel::Create(platform_handle.Pass()))); 77 CHECK(channel_->Init(RawChannel::Create(platform_handle.Pass())));
77 78
78 // Attach the message pipe endpoint. 79 // Attach the message pipe endpoint.
79 // Note: On the "server" (parent process) side, we need not attach the 80 // Note: On the "server" (parent process) side, we need not attach the
80 // message pipe endpoint immediately. However, on the "client" (child 81 // message pipe endpoint immediately. However, on the "client" (child
81 // process) side, this *must* be done here -- otherwise, the |Channel| may 82 // process) side, this *must* be done here -- otherwise, the |Channel| may
82 // receive/process messages (which it can do as soon as it's hooked up to 83 // receive/process messages (which it can do as soon as it's hooked up to
83 // the IO thread message loop, and that message loop runs) before the 84 // the IO thread message loop, and that message loop runs) before the
84 // message pipe endpoint is attached. 85 // message pipe endpoint is attached.
85 CHECK_EQ(channel_->AttachMessagePipeEndpoint(message_pipe, 1), 86 CHECK_EQ(channel_->AttachEndpoint(
87 make_scoped_refptr(new ChannelEndpoint(message_pipe.get(), 1))),
86 Channel::kBootstrapEndpointId); 88 Channel::kBootstrapEndpointId);
87 CHECK(channel_->RunMessagePipeEndpoint(Channel::kBootstrapEndpointId, 89 CHECK(channel_->RunMessagePipeEndpoint(Channel::kBootstrapEndpointId,
88 Channel::kBootstrapEndpointId)); 90 Channel::kBootstrapEndpointId));
89 } 91 }
90 92
91 void ChannelThread::ShutdownChannelOnIOThread() { 93 void ChannelThread::ShutdownChannelOnIOThread() {
92 CHECK(channel_.get()); 94 CHECK(channel_.get());
93 channel_->Shutdown(); 95 channel_->Shutdown();
94 channel_ = NULL; 96 channel_ = NULL;
95 } 97 }
96 98
97 #if !defined(OS_IOS) 99 #if !defined(OS_IOS)
98 MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase() 100 MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase()
99 : channel_thread_(&platform_support_) { 101 : channel_thread_(&platform_support_) {
100 } 102 }
101 103
102 MultiprocessMessagePipeTestBase::~MultiprocessMessagePipeTestBase() { 104 MultiprocessMessagePipeTestBase::~MultiprocessMessagePipeTestBase() {
103 } 105 }
104 106
105 void MultiprocessMessagePipeTestBase::Init(scoped_refptr<MessagePipe> mp) { 107 void MultiprocessMessagePipeTestBase::Init(scoped_refptr<MessagePipe> mp) {
106 channel_thread_.Start(helper_.server_platform_handle.Pass(), mp); 108 channel_thread_.Start(helper_.server_platform_handle.Pass(), mp);
107 } 109 }
108 #endif 110 #endif
109 111
110 } // namespace test 112 } // namespace test
111 } // namespace system 113 } // namespace system
112 } // namespace mojo 114 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_dispatcher.cc ('k') | mojo/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698