| OLD | NEW |
| 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/channel.h" | 5 #include "mojo/system/channel.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/embedder/platform_channel_pair.h" | 10 #include "mojo/embedder/platform_channel_pair.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 void CreateChannelOnIOThread() { | 44 void CreateChannelOnIOThread() { |
| 45 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 45 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
| 46 channel_ = new Channel(&platform_support_); | 46 channel_ = new Channel(&platform_support_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void InitChannelOnIOThread() { | 49 void InitChannelOnIOThread() { |
| 50 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 50 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
| 51 | 51 |
| 52 CHECK(raw_channel_); | 52 CHECK(raw_channel_); |
| 53 CHECK(channel_); | 53 CHECK(channel_.get()); |
| 54 CHECK_EQ(init_result_, TRISTATE_UNKNOWN); | 54 CHECK_EQ(init_result_, TRISTATE_UNKNOWN); |
| 55 | 55 |
| 56 init_result_ = BoolToTristate(channel_->Init(raw_channel_.Pass())); | 56 init_result_ = BoolToTristate(channel_->Init(raw_channel_.Pass())); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ShutdownChannelOnIOThread() { | 59 void ShutdownChannelOnIOThread() { |
| 60 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 60 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
| 61 | 61 |
| 62 CHECK(channel_); | 62 CHECK(channel_.get()); |
| 63 channel_->Shutdown(); | 63 channel_->Shutdown(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 test::TestIOThread* io_thread() { return &io_thread_; } | 66 test::TestIOThread* io_thread() { return &io_thread_; } |
| 67 RawChannel* raw_channel() { return raw_channel_.get(); } | 67 RawChannel* raw_channel() { return raw_channel_.get(); } |
| 68 scoped_ptr<RawChannel>* mutable_raw_channel() { return &raw_channel_; } | 68 scoped_ptr<RawChannel>* mutable_raw_channel() { return &raw_channel_; } |
| 69 Channel* channel() { return channel_.get(); } | 69 Channel* channel() { return channel_.get(); } |
| 70 scoped_refptr<Channel>* mutable_channel() { return &channel_; } | 70 scoped_refptr<Channel>* mutable_channel() { return &channel_; } |
| 71 Tristate init_result() const { return init_result_; } | 71 Tristate init_result() const { return init_result_; } |
| 72 | 72 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 mp->Close(0); | 313 mp->Close(0); |
| 314 | 314 |
| 315 EXPECT_TRUE(channel()->HasOneRef()); | 315 EXPECT_TRUE(channel()->HasOneRef()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 // TODO(vtl): More. ------------------------------------------------------------ | 318 // TODO(vtl): More. ------------------------------------------------------------ |
| 319 | 319 |
| 320 } // namespace | 320 } // namespace |
| 321 } // namespace system | 321 } // namespace system |
| 322 } // namespace mojo | 322 } // namespace mojo |
| OLD | NEW |