OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/scoped_ipc_support.h" | 5 #include "mojo/edk/test/scoped_ipc_support.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/edk/embedder/embedder.h" | 8 #include "mojo/edk/embedder/embedder.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 namespace edk { | 11 namespace edk { |
12 namespace test { | 12 namespace test { |
13 | 13 |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 ScopedIPCSupportHelper::ScopedIPCSupportHelper() { | 16 ScopedIPCSupportHelper::ScopedIPCSupportHelper() { |
17 } | 17 } |
18 | 18 |
19 ScopedIPCSupportHelper::~ScopedIPCSupportHelper() { | 19 ScopedIPCSupportHelper::~ScopedIPCSupportHelper() { |
20 if (base::MessageLoop::current() && | 20 if (base::MessageLoop::current() && |
21 base::MessageLoop::current()->task_runner() == io_thread_task_runner_) { | 21 base::MessageLoop::current()->task_runner() == io_thread_task_runner_) { |
22 ShutdownIPCSupportOnIOThread(); | 22 ShutdownIPCSupportOnIOThread(); |
23 } else { | 23 } else { |
24 ShutdownIPCSupportAndWaitForNoChannels(); | 24 ShutdownIPCSupport(); |
25 run_loop_.Run(); | 25 run_loop_.Run(); |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 void ScopedIPCSupportHelper::Init( | 29 void ScopedIPCSupportHelper::Init( |
30 ProcessDelegate* process_delegate, | 30 ProcessDelegate* process_delegate, |
31 scoped_refptr<base::TaskRunner> io_thread_task_runner) { | 31 scoped_refptr<base::TaskRunner> io_thread_task_runner) { |
32 io_thread_task_runner_ = io_thread_task_runner; | 32 io_thread_task_runner_ = io_thread_task_runner; |
33 InitIPCSupport(process_delegate, io_thread_task_runner_); | 33 InitIPCSupport(process_delegate, io_thread_task_runner_); |
34 } | 34 } |
(...skipping 12 matching lines...) Expand all Loading... |
47 ScopedIPCSupport::~ScopedIPCSupport() { | 47 ScopedIPCSupport::~ScopedIPCSupport() { |
48 } | 48 } |
49 | 49 |
50 void ScopedIPCSupport::OnShutdownComplete() { | 50 void ScopedIPCSupport::OnShutdownComplete() { |
51 helper_.OnShutdownCompleteImpl(); | 51 helper_.OnShutdownCompleteImpl(); |
52 } | 52 } |
53 | 53 |
54 } // namespace test | 54 } // namespace test |
55 } // namespace edk | 55 } // namespace edk |
56 } // namespace mojo | 56 } // namespace mojo |
OLD | NEW |