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

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

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist Created 6 years 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/edk/system/message_pipe.cc ('k') | mojo/edk/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/edk/system/message_pipe_test_utils.h" 5 #include "mojo/edk/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/edk/system/channel.h" 9 #include "mojo/edk/system/channel.h"
10 #include "mojo/edk/system/channel_endpoint.h" 10 #include "mojo/edk/system/channel_endpoint.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void ChannelThread::InitChannelOnIOThread( 69 void ChannelThread::InitChannelOnIOThread(
70 embedder::ScopedPlatformHandle platform_handle, 70 embedder::ScopedPlatformHandle platform_handle,
71 scoped_refptr<ChannelEndpoint> channel_endpoint) { 71 scoped_refptr<ChannelEndpoint> channel_endpoint) {
72 CHECK_EQ(base::MessageLoop::current(), test_io_thread_.message_loop()); 72 CHECK_EQ(base::MessageLoop::current(), test_io_thread_.message_loop());
73 CHECK(platform_handle.is_valid()); 73 CHECK(platform_handle.is_valid());
74 74
75 // Create and initialize |Channel|. 75 // Create and initialize |Channel|.
76 channel_ = new Channel(platform_support_); 76 channel_ = new Channel(platform_support_);
77 CHECK(channel_->Init(RawChannel::Create(platform_handle.Pass()))); 77 CHECK(channel_->Init(RawChannel::Create(platform_handle.Pass())));
78 78
79 // Attach and run the endpoint. 79 // Start the bootstrap endpoint.
80 // Note: On the "server" (parent process) side, we need not attach/run the 80 // Note: On the "server" (parent process) side, we need not attach/run the
81 // endpoint immediately. However, on the "client" (child process) side, this 81 // endpoint immediately. However, on the "client" (child process) side, this
82 // *must* be done here -- otherwise, the |Channel| may receive/process 82 // *must* be done here -- otherwise, the |Channel| may receive/process
83 // messages (which it can do as soon as it's hooked up to the IO thread 83 // messages (which it can do as soon as it's hooked up to the IO thread
84 // message loop, and that message loop runs) before the endpoint is attached. 84 // message loop, and that message loop runs) before the endpoint is attached.
85 channel_->AttachAndRunEndpoint(channel_endpoint, true); 85 channel_->SetBootstrapEndpoint(channel_endpoint);
86 } 86 }
87 87
88 void ChannelThread::ShutdownChannelOnIOThread() { 88 void ChannelThread::ShutdownChannelOnIOThread() {
89 CHECK(channel_); 89 CHECK(channel_);
90 channel_->Shutdown(); 90 channel_->Shutdown();
91 channel_ = nullptr; 91 channel_ = nullptr;
92 } 92 }
93 93
94 #if !defined(OS_IOS) 94 #if !defined(OS_IOS)
95 MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase() 95 MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase()
96 : channel_thread_(&platform_support_) { 96 : channel_thread_(&platform_support_) {
97 } 97 }
98 98
99 MultiprocessMessagePipeTestBase::~MultiprocessMessagePipeTestBase() { 99 MultiprocessMessagePipeTestBase::~MultiprocessMessagePipeTestBase() {
100 } 100 }
101 101
102 void MultiprocessMessagePipeTestBase::Init(scoped_refptr<ChannelEndpoint> ep) { 102 void MultiprocessMessagePipeTestBase::Init(scoped_refptr<ChannelEndpoint> ep) {
103 channel_thread_.Start(helper_.server_platform_handle.Pass(), ep); 103 channel_thread_.Start(helper_.server_platform_handle.Pass(), ep);
104 } 104 }
105 #endif 105 #endif
106 106
107 } // namespace test 107 } // namespace test
108 } // namespace system 108 } // namespace system
109 } // namespace mojo 109 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698