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(ProcessErrorCallback callback)34 void SetDefaultProcessErrorCallback(ProcessErrorCallback callback) {
35   Core::Get()->SetDefaultProcessErrorCallback(std::move(callback));
36 }
37 
GetIOTaskRunner()38 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() {
39   return Core::Get()->GetNodeController()->io_task_runner();
40 }
41 
42 }  // namespace core
43 }  // namespace mojo
44