Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / mojo / python / system / mojo / embedder.pyx
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 # distutils: language = c++
6
7 from libc.stdint cimport uintptr_t
8
9 from mojo import system
10
11 cdef extern from "third_party/cython/python_export.h":
12   pass
13
14 cdef extern from "base/memory/scoped_ptr.h":
15   cdef cppclass scoped_ptr[T]:
16     scoped_ptr(T*)
17
18 cdef extern from "mojo/embedder/platform_support.h" \
19     namespace "mojo::embedder" nogil:
20   cdef cppclass PlatformSupport:
21     pass
22
23 cdef extern from "mojo/embedder/simple_platform_support.h" \
24     namespace "mojo::embedder" nogil:
25   cdef cppclass SimplePlatformSupport(PlatformSupport):
26     SimplePlatformSupport()
27
28 cdef extern from "mojo/embedder/embedder.h" nogil:
29   cdef void InitCEmbedder "mojo::embedder::Init"(
30       scoped_ptr[PlatformSupport] platform_support)
31
32 cdef extern from "mojo/public/platform/native/system_thunks.h" nogil:
33   cdef struct MojoSystemThunks:
34     pass
35   cdef MojoSystemThunks MojoMakeSystemThunks()
36
37 def Init():
38   InitCEmbedder(scoped_ptr[PlatformSupport](
39       new SimplePlatformSupport()))
40   cdef MojoSystemThunks thunks = MojoMakeSystemThunks()
41   system.SetSystemThunks(<uintptr_t>(&thunks))