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

Unified Diff: mojo/edk/base_edk/platform_message_loop_impl.h

Issue 1469193002: EDK: Add a mojo::platform::MessageLoop abstraction. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/base_edk/BUILD.gn ('k') | mojo/edk/base_edk/platform_message_loop_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/base_edk/platform_message_loop_impl.h
diff --git a/mojo/edk/base_edk/platform_message_loop_impl.h b/mojo/edk/base_edk/platform_message_loop_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..a25b01369790b754e17e7f98aaf87ff6ca051225
--- /dev/null
+++ b/mojo/edk/base_edk/platform_message_loop_impl.h
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file provides an implementation of |mojo::platform::MessageLoop| that
+// wraps a |base::MessageLoop|.
+
+#ifndef MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_
+#define MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/platform/message_loop.h"
+#include "mojo/edk/platform/task_runner.h"
+
+namespace base_edk {
+
+class PlatformMessageLoopImpl : public mojo::platform::MessageLoop {
+ public:
+ explicit PlatformMessageLoopImpl(
+ base::MessageLoop::Type type = base::MessageLoop::TYPE_DEFAULT);
+ explicit PlatformMessageLoopImpl(scoped_ptr<base::MessagePump> pump);
+ ~PlatformMessageLoopImpl() override;
+
+ const base::MessageLoop& base_message_loop() const {
+ return base_message_loop_;
+ }
+ base::MessageLoop& base_message_loop() { return base_message_loop_; }
+
+ // |mojo::platform::MessageLoop| implementation:
+ void Run() override;
+ void RunUntilIdle() override;
+ void QuitWhenIdle() override;
+ const mojo::util::RefPtr<mojo::platform::TaskRunner>& GetTaskRunner()
+ const override;
+ bool IsRunningOnCurrentThread() const override;
+
+ private:
+ base::MessageLoop base_message_loop_;
+ mojo::util::RefPtr<mojo::platform::TaskRunner> task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformMessageLoopImpl);
+};
+
+} // namespace base_edk
+
+#endif // MOJO_EDK_BASE_EDK_PLATFORM_MESSAGE_LOOP_IMPL_H_
« no previous file with comments | « mojo/edk/base_edk/BUILD.gn ('k') | mojo/edk/base_edk/platform_message_loop_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698