访问tomcat8080 为啥进入了 cef remote debugging
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了访问tomcat8080 为啥进入了 cef remote debugging相关的知识,希望对你有一定的参考价值。
参考技术A Application Structure应用程序结构
Every CEF3 application has the same general structure.
Provide an entry-point function that initializes CEF and runs either sub-process executable logic or the CEF message loop.
Provide an implementation of CefApp to handle process-specific callbacks.
Provide an implementation of CefClient to handle browser-instance-specific callbacks.
Call CefBrowserHost::CreateBrowser() to create a browser instance and manage the browser life span using CefLifeSpanHandler.
每个CEF3应用程序都是相同的结构
提供入口函数,用于初始化CEF、运行子进程执行逻辑或者CEF消息循环。
提供CefApp实现,用于处理进程相关的回调。
提供CefClient实现,用于处理browser实例相关的回调
执行CefBrowserHost::CreateBrowser()创建一个browser实例,使用CefLifeSpanHandler管理browser对象生命周期。
Entry-Point Function
入口函数
As described in the “Processes” section a CEF3 application will run multiple processes. The processes can all use the same executable or a separate executable can be specified for the sub-processes. Execution of the process begins in the entry-point function. Complete platform-specific examples for Windows, Linux and Mac OS-X are available in cefclient_win.cc, cefclient_gtk.cc and cefclient_mac.mm respectively.
像本文中进程章节描述的那样,一个CEF3应用程序会运行多个进程,这些进程能够使用同一个执行器或者为子进程定制的、单独的执行器。进程的执行从入口函数开始,示例cefclient_win.cc、cefclient_gtk.cc、cefclient_mac.mm分别对应Windows、Linux和Mac OS-X平台下的实现。
When launching sub-processes CEF will specify configuration information using the command-line that must be passed into the CefExecuteProcess function via the CefMainArgs structure. The definition of CefMainArgs is platform-specific. On Linux and Mac OS X it accepts the argc and argv values which are passed into the main() function.
当执行子进程是,CEF将使用命令行参数指定配置信息,这些命令行参数必须通过CefMainArgs结构体传入到CefExecuteProcess函数。CefMainArgs的定义与平台相关,在Linux、Mac OS X平台下,它接收main函数传入的argc和argv参数值。
CefMainArgs main_args(argc, argv);
On Windows it accepts the instance handle (HINSTANCE) which is passed into the wWinMain() function. The instance handle is also retrievable via GetModuleHandle(NULL).
在Windows平台下,它接收wWinMain函数传入的参数:实例句柄(HINSTANCE),这个实例能够通过函数GetModuleHandle(NULL)获取。
CefMainArgs main_args(hInstance);
Single Executable
单个执行器
When running as a single executable the entry-point function is required to differentiate between the different process types. The single executable structure is supported on Windows and Linux but not on Mac OS X.
当运行单个执行器时,根据不同的进程类型,入口函数有差异。Windows、Linux平台支持单个执行器架构,Mac OS X平台则不行。
// 程序执行函数int main(int argc, char* argv[]) // Structure for passing command-line arguments. // The definition of this structure is platform-specific. // 传递命令行参数的结构体。 // 这个结构体的定义与平台相关。 CefMainArgs main_args(argc, argv); // Optional implementation of the CefApp interface. // 可选择地实现CefApp接口 CefRefPtr<MyApp> app(new MyApp); // Execute the sub-process logic, if any. This will either return immediately for the browser // process or block until the sub-process should exit. // 可能会执行子进程逻辑,这个函数的执行在browser进程时会立即返回,在子进程时会堵塞直到退出时返回。 int exit_code = CefExecuteProcess(main_args, app.get()); if (exit_code >= 0) // The sub-process terminated, exit now. // 子进程被终结,立即结束。 return exit_code; // Populate this structure to customize CEF behavior. // 填充这个结构体,用于定制CEF的行为。 CefSettings settings; // Initialize CEF in the main process. // 在main进程中初始化CEF CefInitialize(main_args, settings, app.get()); // Run the CEF message loop. This will block until CefQuitMessageLoop() is called. // 执行消息循环,此时会堵塞,直到CefQuitMessageLoop()函数被调用。 CefRunMessageLoop(); // Shut down CEF. // 退出CEF。 CefShutdown(); return 0;
Separate Sub-Process Executable
单独子进程执行器
When using a separate sub-process executable you need two separate executable projects and two separate entry-point functions.
当使用一个单独子进程执行器时,你需要2个分开的可执行工程和2个分开的入口函数。
Main application entry-point function:
主程序的入口函数:
// Program entry-point function.// 程序入口函数int main(int argc, char* argv[]) // Structure for passing command-line arguments. // The definition of this structure is platform-specific. // 传递命令行参数的结构体。 // 这个结构体的定义与平台相关。 CefMainArgs main_args(argc, argv); // Optional implementation of the CefApp interface. // 可选择性地实现CefApp接口 CefRefPtr<MyApp> app(new MyApp); // Populate this structure to customize CEF behavior. // 填充这个结构体,用于定制CEF的行为。 CefSettings settings; // Specify the path for the sub-process executable. // 指定子进程的执行路径 CefString(&settings.browser_subprocess_path).FromASCII(“/path/to/subprocess”); // Initialize CEF in the main process. // 在主进程中初始化CEF CefInitialize(main_args, settings, app.get()); // Run the CEF message loop. This will block until CefQuitMessageLoop() is called. // 执行消息循环,此时会堵塞,直到CefQuitMessageLoop()函数被调用。 CefRunMessageLoop(); // Shut down CEF. // 关闭CEF CefShutdown(); return 0;
Sub-process application entry-point function: 子进程程序的入口函数:
// Program entry-point function.// 程序入口函数int main(int argc, char* argv[]) // Structure for passing command-line arguments. // The definition of this structure is platform-specific. // 传递命令行参数的结构体。 // 这个结构体的定义与平台相关。 CefMainArgs main_args(argc, argv); // Optional implementation of the CefApp interface. // 可选择性地实现CefApp接口 CefRefPtr<MyApp> app(new MyApp); // Execute the sub-process logic. This will block until the sub-process should exit. // 执行子进程逻辑,此时会堵塞直到子进程退出。 return CefExecuteProcess(main_args, app.get());
Message Loop Integration
集成消息循环
CEF can also integrate with an existing application message loop instead of running its own message loop. There are two ways to do this.
CEF可以不用它自己提供的消息循环,而与已经存在的程序中消息环境集成在一起,有两种方式可以做到:
Call CefDoMessageLoopWork() on a regular basis instead of calling CefRunMessageLoop(). Each call to CefDoMessageLoopWork() will perform a single iteration of the CEF message loop. Caution should be used with this approach. Calling the method too infrequently will starve the CEF message loop and negatively impact browser performance. Calling the method too frequently will negatively impact CPU usage.
Set CefSettings.multi_threaded_message_loop = true (Windows only). This will cause CEF to run the browser UI thread on a separate thread from the main application thread. With this approach neither CefDoMessageLoopWork() nor CefRunMessageLoop() need to be called. CefInitialize() and CefShutdown() should still be called on the main application thread. You will need to provide your own mechanism for communicating with the main application thread (see for example the message window usage in cefclient_win.cpp). You can test this mode in cefclient on Windows by running with the “--multi-threaded-message-loop” command-line flag.
周期性执行CefDoMessageLoopWork()函数,替代调用CefRunMessageLoop()。CefDoMessageLoopWork()的每一次调用,都将执行一次CEF消息循环的单次迭代。需要注意的是,此方法调用次数太少时,CEF消息循环会饿死,将极大的影响browser的性能,调用次数太频繁又将影响CPU使用率。
以上是关于访问tomcat8080 为啥进入了 cef remote debugging的主要内容,如果未能解决你的问题,请参考以下文章
ubuntu系统下 tomcat的sartup已经启动了 但是为啥不能访问localhost:8080
新解压的tomcat为啥不能正常启动访问8080端口?(百分百有效)