Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
cef_main.cxx
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2017-06-29
3// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
6// reserved. Use of this source code is governed by a BSD-style license that
7// can be found in the LICENSE file.
8
9/*************************************************************************
10 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
11 * All rights reserved. *
12 * *
13 * For the licensing terms see $ROOTSYS/LICENSE. *
14 * For the list of contributors see $ROOTSYS/README/CREDITS. *
15 *************************************************************************/
16
17#if !defined(_MSC_VER)
18#pragma GCC diagnostic ignored "-Wunused-parameter"
19#pragma GCC diagnostic ignored "-Wshadow"
20#endif
21
22#include "include/base/cef_build.h"
23#include "include/cef_app.h"
24
25#if !defined(OS_WIN)
26#include <unistd.h>
27#endif
28
29// #include "include/cef_render_process_handler.h"
30#include "include/base/cef_logging.h"
31
32// Implement application-level callbacks for the browser process.
33class MyRendererProcessApp : public CefApp /*, public CefRenderProcessHandler */ {
34
35public:
36 MyRendererProcessApp() : CefApp() /*, CefRenderProcessHandler() */ {}
38
39// CefRefPtr< CefRenderProcessHandler > GetRenderProcessHandler() override { return this; }
40
41// void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override
42// {
43// // registrar->AddCustomScheme("rootscheme", true, true, true, true, true, true);
44// }
45
46
47private:
48 // Include the default reference counting implementation.
51};
52
53// Entry point function for all processes.
54int main(int argc, char *argv[])
55{
56
57#if defined(OS_WIN)
58 CefMainArgs main_args(::GetModuleHandle(NULL));
59#else
60 // Provide CEF with command-line arguments.
61 CefMainArgs main_args(argc, argv);
62#endif
63
64 CefRefPtr<CefApp> app = new MyRendererProcessApp();
65
66 // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
67 // that share the same executable. This function checks the command-line and,
68 // if this is a sub-process, executes the appropriate logic.
69 int exit_code = CefExecuteProcess(main_args, app, NULL);
70 if (exit_code >= 0) {
71 // The sub-process has completed so return here.
72 return exit_code;
73 }
74
75 return 0;
76}
int main()
Definition Prototype.cxx:12
~MyRendererProcessApp() override
Definition cef_main.cxx:37
IMPLEMENT_REFCOUNTING(MyRendererProcessApp)
DISALLOW_COPY_AND_ASSIGN(MyRendererProcessApp)