| Index: mojo/edk/embedder/multiprocess_embedder.cc
|
| diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/multiprocess_embedder.cc
|
| similarity index 80%
|
| copy from mojo/edk/embedder/embedder.cc
|
| copy to mojo/edk/embedder/multiprocess_embedder.cc
|
| index 5707d45b21a9bf3b0fed2ad711fa005b8a729507..2b7cdc73a51d783c906f1f0c70777ee4305e7d76 100644
|
| --- a/mojo/edk/embedder/embedder.cc
|
| +++ b/mojo/edk/embedder/multiprocess_embedder.cc
|
| @@ -1,8 +1,8 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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.
|
|
|
| -#include "mojo/edk/embedder/embedder.h"
|
| +#include "mojo/edk/embedder/multiprocess_embedder.h"
|
|
|
| #include <utility>
|
|
|
| @@ -10,16 +10,13 @@
|
| #include "base/logging.h"
|
| #include "mojo/edk/embedder/embedder_internal.h"
|
| #include "mojo/edk/embedder/master_process_delegate.h"
|
| -#include "mojo/edk/embedder/platform_support.h"
|
| #include "mojo/edk/embedder/process_delegate.h"
|
| #include "mojo/edk/embedder/slave_process_delegate.h"
|
| #include "mojo/edk/system/channel.h"
|
| #include "mojo/edk/system/channel_manager.h"
|
| -#include "mojo/edk/system/configuration.h"
|
| #include "mojo/edk/system/core.h"
|
| #include "mojo/edk/system/ipc_support.h"
|
| #include "mojo/edk/system/message_pipe_dispatcher.h"
|
| -#include "mojo/edk/system/platform_handle_dispatcher.h"
|
| #include "mojo/edk/system/raw_channel.h"
|
| #include "mojo/edk/util/ref_ptr.h"
|
|
|
| @@ -34,8 +31,6 @@ namespace embedder {
|
| namespace internal {
|
|
|
| // Declared in embedder_internal.h.
|
| -PlatformSupport* g_platform_support = nullptr;
|
| -system::Core* g_core = nullptr;
|
| system::IPCSupport* g_ipc_support = nullptr;
|
|
|
| } // namespace internal
|
| @@ -65,65 +60,6 @@ system::ChannelId MakeChannelId() {
|
|
|
| } // namespace
|
|
|
| -Configuration* GetConfiguration() {
|
| - return system::GetMutableConfiguration();
|
| -}
|
| -
|
| -void Init(std::unique_ptr<PlatformSupport> platform_support) {
|
| - DCHECK(platform_support);
|
| -
|
| - DCHECK(!internal::g_platform_support);
|
| - internal::g_platform_support = platform_support.release();
|
| -
|
| - DCHECK(!internal::g_core);
|
| - internal::g_core = new system::Core(internal::g_platform_support);
|
| -}
|
| -
|
| -MojoResult AsyncWait(MojoHandle handle,
|
| - MojoHandleSignals signals,
|
| - const std::function<void(MojoResult)>& callback) {
|
| - return internal::g_core->AsyncWait(handle, signals, callback);
|
| -}
|
| -
|
| -MojoResult CreatePlatformHandleWrapper(
|
| - ScopedPlatformHandle platform_handle,
|
| - MojoHandle* platform_handle_wrapper_handle) {
|
| - DCHECK(platform_handle_wrapper_handle);
|
| -
|
| - auto dispatcher =
|
| - system::PlatformHandleDispatcher::Create(platform_handle.Pass());
|
| -
|
| - DCHECK(internal::g_core);
|
| - MojoHandle h = internal::g_core->AddDispatcher(dispatcher.get());
|
| - if (h == MOJO_HANDLE_INVALID) {
|
| - LOG(ERROR) << "Handle table full";
|
| - dispatcher->Close();
|
| - return MOJO_RESULT_RESOURCE_EXHAUSTED;
|
| - }
|
| -
|
| - *platform_handle_wrapper_handle = h;
|
| - return MOJO_RESULT_OK;
|
| -}
|
| -
|
| -MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
|
| - ScopedPlatformHandle* platform_handle) {
|
| - DCHECK(platform_handle);
|
| -
|
| - DCHECK(internal::g_core);
|
| - auto dispatcher =
|
| - internal::g_core->GetDispatcher(platform_handle_wrapper_handle);
|
| - if (!dispatcher)
|
| - return MOJO_RESULT_INVALID_ARGUMENT;
|
| -
|
| - if (dispatcher->GetType() != system::Dispatcher::Type::PLATFORM_HANDLE)
|
| - return MOJO_RESULT_INVALID_ARGUMENT;
|
| -
|
| - *platform_handle =
|
| - static_cast<system::PlatformHandleDispatcher*>(dispatcher.get())
|
| - ->PassPlatformHandle();
|
| - return MOJO_RESULT_OK;
|
| -}
|
| -
|
| void InitIPCSupport(ProcessType process_type,
|
| RefPtr<TaskRunner>&& delegate_thread_task_runner,
|
| ProcessDelegate* process_delegate,
|
|
|