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-2019, 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// virtual CefRefPtr< CefRenderProcessHandler > GetRenderProcessHandler() { 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 // printf("Starting CEF_MAIN ARGC %d\n", argc);
57 // for (int n = 1; n < argc; n++) printf("ARGV[%d] = %s\n", n, argv[n]);
58
59#if defined(OS_WIN)
60 CefMainArgs main_args(::GetModuleHandle(NULL));
61#else
62 // Provide CEF with command-line arguments.
63 CefMainArgs main_args(argc, argv);
64#endif
65
66 CefRefPtr<CefApp> app = new MyRendererProcessApp();
67
68 // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
69 // that share the same executable. This function checks the command-line and,
70 // if this is a sub-process, executes the appropriate logic.
71 int exit_code = CefExecuteProcess(main_args, app, NULL);
72 if (exit_code >= 0) {
73 // The sub-process has completed so return here.
74 return exit_code;
75 }
76
77 return 0;
78}
int main()
Definition Prototype.cxx:12
virtual ~MyRendererProcessApp()
Definition cef_main.cxx:37
IMPLEMENT_REFCOUNTING(MyRendererProcessApp)
DISALLOW_COPY_AND_ASSIGN(MyRendererProcessApp)