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

Unified Diff: ipc/mojo/scoped_ipc_support.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to mojo::edk namespace in preparation for runtim flag Created 5 years, 3 months 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
Index: ipc/mojo/scoped_ipc_support.cc
diff --git a/ipc/mojo/scoped_ipc_support.cc b/ipc/mojo/scoped_ipc_support.cc
index b1d530e0463aedfe7c4e18f13a9aa94e31142395..0d9253990a898a8a2dcbf829ea42b2cd1f407333 100644
--- a/ipc/mojo/scoped_ipc_support.cc
+++ b/ipc/mojo/scoped_ipc_support.cc
@@ -12,14 +12,23 @@
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/thread_task_runner_handle.h"
+
+#if defined(USE_CHROME_EDK)
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/process_delegate.h"
+#else
#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
#include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
+#endif
namespace IPC {
namespace {
-
+#if defined(USE_CHROME_EDK)
+class IPCSupportInitializer : public mojo::edk::ProcessDelegate {
+#else
class IPCSupportInitializer : public mojo::embedder::ProcessDelegate {
+#endif
public:
IPCSupportInitializer()
: init_count_(0),
@@ -105,9 +114,16 @@ void IPCSupportInitializer::Init(
io_thread_task_runner_ = io_thread_task_runner;
io_thread_task_runner_->PostTask(
FROM_HERE, base::Bind(&WatchMessageLoopOnIOThread, observer_));
+
+#if defined(USE_CHROME_EDK)
+ mojo::edk::InitIPCSupport(
+ io_thread_task_runner_, this, io_thread_task_runner_,
+ mojo::edk::ScopedPlatformHandle());
+#else
mojo::embedder::InitIPCSupport(
- mojo::embedder::ProcessType::NONE, io_thread_task_runner_, this,
- io_thread_task_runner_, mojo::embedder::ScopedPlatformHandle());
+ mojo::embedder::ProcessType::NONE, io_thread_task_runner_, this, io_thread_task_runner_,
+ mojo::embedder::ScopedPlatformHandle());
+#endif
}
}
@@ -144,7 +160,11 @@ void IPCSupportInitializer::ForceShutdown() {
void IPCSupportInitializer::ShutDownOnIOThread() {
base::AutoLock locker(lock_);
if (shutting_down_ && !was_shut_down_) {
+#if defined(USE_CHROME_EDK)
+ mojo::edk::ShutdownIPCSupportOnIOThread();
+#else
mojo::embedder::ShutdownIPCSupportOnIOThread();
+#endif
init_count_ = 0;
shutting_down_ = false;
io_thread_task_runner_ = nullptr;

Powered by Google App Engine
This is Rietveld 408576698