tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GeckoRuntime.swift (941B)


      1 // This Source Code Form is subject to the terms of the Mozilla Public
      2 // License, v. 2.0. If a copy of the MPL was not distributed with this
      3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 class RuntimeImpl : NSObject, SwiftGeckoViewRuntime {
      6    func runtimeDispatcher() -> any SwiftEventDispatcher {
      7        return EventDispatcher.runtimeInstance
      8    }
      9    func dispatcher(byName name: UnsafePointer<CChar>!) -> any SwiftEventDispatcher {
     10        return EventDispatcher.lookup(byName: String(cString: name))
     11    }
     12 }
     13 
     14 public class GeckoRuntime {
     15    static var runtime = RuntimeImpl()
     16 
     17    public static func main(
     18        argc: Int32,
     19        argv: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>
     20    ) {
     21        MainProcessInit(argc, argv, runtime)
     22    }
     23 
     24    public static func childMain(xpcConnection: xpc_connection_t, process: GeckoProcessExtension) {
     25        ChildProcessInit(xpcConnection, process, runtime)
     26    }
     27 }