예제 #1
0
func NewClientHandlerT(handler ClientHandler) ClientHandlerT {
	var c ClientHandlerT
	c.CStruct = (*C.struct__cef_client_t)(
		C.calloc(1, C.sizeof_struct__cef_client_t))
	C.initialize_client_handler(c.CStruct)
	go_AddRef(unsafe.Pointer(c.CStruct))
	Logger.Infof("_ClientHandler: %x", unsafe.Pointer(c.CStruct))
	clientHandlerMap[unsafe.Pointer(c.CStruct)] = handler
	return c
}
예제 #2
0
파일: cef.go 프로젝트: mmatey/cef2go
func _InitializeGlobalCStructures() {
	_MainArgs = (*C.struct__cef_main_args_t)(C.calloc(1, C.sizeof_struct__cef_main_args_t))
	go_AddRef(unsafe.Pointer(_MainArgs))

	_AppHandler = (*C.cef_app_t)(C.calloc(1, C.sizeof_cef_app_t))
	go_AddRef(unsafe.Pointer(_AppHandler))
	C.initialize_app_handler(_AppHandler)

	_ClientHandler = (*C.struct__cef_client_t)(C.calloc(1, C.sizeof_struct__cef_client_t))
	go_AddRef(unsafe.Pointer(_ClientHandler))
	C.initialize_client_handler(_ClientHandler)
}
예제 #3
0
파일: cef.go 프로젝트: hernad/cef2go
func _InitializeGlobalCStructures() {
	_MainArgs = (*C.struct__cef_main_args_t)(
		C.calloc(1, C.sizeof_struct__cef_main_args_t))

	// Some bug in Go on Windows: "unexpected fault address 0xffffffff".
	// Happens in cef_execute_process() when initialize_app_handler()
	// or initialize_client_handler() are called here. This same code
	// works perfectly fine on Linux and OS X. From the logs:
	// [cef] cef.go:88: ExecuteProcess, args= [cef2go.exe]
	// initialize_app_handler
	// initialize_cef_base
	// cef_base_t.size = 36
	// initialize_client_handler
	// initialize_cef_base
	// cef_base_t.size = 72
	// [cef] cef_windows.go:19: FillMainArgs
	// cef_base_t.add_ref
	// unexpected fault address 0xffffffff
	// fatal error: fault
	// So it looks like the problem occurs after the first call to
	// add_ref made by CEF.
	// Maybe that's the bug - some problem during linking:
	// "cmd/ld: order of files in archives matters on Windows"
	// https://code.google.com/p/go/issues/detail?id=2601

	_AppHandler = (*C.cef_app_t)(
		C.calloc(1, C.sizeof_cef_app_t))
	if runtime.GOOS != "windows" {
		C.initialize_app_handler(_AppHandler)
	}

	_ClientHandler = (*C.struct__cef_client_t)(
		C.calloc(1, C.sizeof_struct__cef_client_t))
	if runtime.GOOS != "windows" {
		C.initialize_client_handler(_ClientHandler)
	}
}