| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/edk/base_edk/platform_message_loop_impl.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "mojo/edk/base_edk/platform_task_runner_impl.h" |
| 10 |
| 11 using mojo::platform::TaskRunner; |
| 12 using mojo::util::MakeRefCounted; |
| 13 using mojo::util::RefPtr; |
| 14 |
| 15 namespace base_edk { |
| 16 |
| 17 PlatformMessageLoopImpl::PlatformMessageLoopImpl(base::MessageLoop::Type type) |
| 18 : base_message_loop_(type), |
| 19 task_runner_(MakeRefCounted<PlatformTaskRunnerImpl>( |
| 20 base_message_loop_.task_runner())) {} |
| 21 |
| 22 PlatformMessageLoopImpl::PlatformMessageLoopImpl( |
| 23 scoped_ptr<base::MessagePump> pump) |
| 24 : base_message_loop_(std::move(pump)), |
| 25 task_runner_(MakeRefCounted<PlatformTaskRunnerImpl>( |
| 26 base_message_loop_.task_runner())) {} |
| 27 |
| 28 PlatformMessageLoopImpl::~PlatformMessageLoopImpl() {} |
| 29 |
| 30 void PlatformMessageLoopImpl::Run() { |
| 31 base_message_loop_.Run(); |
| 32 } |
| 33 |
| 34 void PlatformMessageLoopImpl::RunUntilIdle() { |
| 35 base_message_loop_.RunUntilIdle(); |
| 36 } |
| 37 |
| 38 void PlatformMessageLoopImpl::QuitWhenIdle() { |
| 39 base_message_loop_.QuitWhenIdle(); |
| 40 } |
| 41 |
| 42 const RefPtr<TaskRunner>& PlatformMessageLoopImpl::GetTaskRunner() const { |
| 43 return task_runner_; |
| 44 } |
| 45 |
| 46 bool PlatformMessageLoopImpl::IsRunningOnCurrentThread() const { |
| 47 return base::MessageLoop::current() == &base_message_loop_ && |
| 48 base_message_loop_.is_running(); |
| 49 } |
| 50 |
| 51 } // namespace base_edk |
| OLD | NEW |