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