| 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 // This file provides an implementation of |mojo::platform::MessageLoop| that |
| 6 // wraps a |base::MessageLoop|. |
| 7 |
| 8 #ifndef MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_ |
| 9 #define MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_ |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" |
| 14 #include "mojo/edk/platform/message_loop.h" |
| 15 #include "mojo/edk/platform/task_runner.h" |
| 16 |
| 17 namespace base_edk { |
| 18 |
| 19 class PlatformMessageLoopImpl : public mojo::platform::MessageLoop { |
| 20 public: |
| 21 explicit PlatformMessageLoopImpl( |
| 22 base::MessageLoop::Type type = base::MessageLoop::TYPE_DEFAULT); |
| 23 explicit PlatformMessageLoopImpl(scoped_ptr<base::MessagePump> pump); |
| 24 ~PlatformMessageLoopImpl() override; |
| 25 |
| 26 const base::MessageLoop& base_message_loop() const { |
| 27 return base_message_loop_; |
| 28 } |
| 29 base::MessageLoop& base_message_loop() { return base_message_loop_; } |
| 30 |
| 31 // |mojo::platform::MessageLoop| implementation: |
| 32 void Run() override; |
| 33 void RunUntilIdle() override; |
| 34 void QuitWhenIdle() override; |
| 35 const mojo::util::RefPtr<mojo::platform::TaskRunner>& GetTaskRunner() |
| 36 const override; |
| 37 bool IsRunningOnCurrentThread() const override; |
| 38 |
| 39 private: |
| 40 base::MessageLoop base_message_loop_; |
| 41 mojo::util::RefPtr<mojo::platform::TaskRunner> task_runner_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(PlatformMessageLoopImpl); |
| 44 }; |
| 45 |
| 46 } // namespace base_edk |
| 47 |
| 48 #endif // MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_ |
| OLD | NEW |