• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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/core/embedder/embedder.h"
6 
7 #include <stdint.h>
8 #include <utility>
9 
10 #include "base/bind.h"
11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/task_runner.h"
14 #include "build/build_config.h"
15 #include "mojo/core/configuration.h"
16 #include "mojo/core/core.h"
17 #include "mojo/core/entrypoints.h"
18 #include "mojo/core/node_controller.h"
19 #include "mojo/public/c/system/thunks.h"
20 
21 namespace mojo {
22 namespace core {
23 
Init(const Configuration & configuration)24 void Init(const Configuration& configuration) {
25   internal::g_configuration = configuration;
26   InitializeCore();
27   MojoEmbedderSetSystemThunks(&GetSystemThunks());
28 }
29 
Init()30 void Init() {
31   Init(Configuration());
32 }
33 
SetDefaultProcessErrorCallback(const ProcessErrorCallback & callback)34 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback) {
35   Core::Get()->SetDefaultProcessErrorCallback(callback);
36 }
37 
GetIOTaskRunner()38 scoped_refptr<base::TaskRunner> GetIOTaskRunner() {
39   return Core::Get()->GetNodeController()->io_task_runner();
40 }
41 
42 #if defined(OS_MACOSX) && !defined(OS_IOS)
SetMachPortProvider(base::PortProvider * port_provider)43 void SetMachPortProvider(base::PortProvider* port_provider) {
44   DCHECK(port_provider);
45   Core::Get()->SetMachPortProvider(port_provider);
46 }
47 #endif
48 
49 }  // namespace core
50 }  // namespace mojo
51