无法使用cefclient创建管道
Unable to create pipe using cefclient
除了入口点(cefclient_win.cc
)外,我在应用程序中几乎是使用cefclient的。
我启动它,出现了一个浏览器窗口,但没有加载任何内容。过了一会儿,刷新按钮启用了,但点击它也没有任何作用。
在日志文件中我得到这个:
[0714/170658:WARNING:ipc_channel_win.cc(276)] Unable to create pipe "\.pipechrome.5432.0.197852861" in client mode: The system cannot find the file specified. (0x2)
[0714/170713:WARNING:ipc_mojo_bootstrap.cc(214)] Detected error on Mojo bootstrap channel.
[0714/170713:WARNING:channel.cc(130)] WriteMessage() while shutting down
[0714/170714:WARNING:ipc_channel_win.cc(276)] Unable to create pipe "\.pipechrome.5432.1.123441216" in client mode: The system cannot find the file specified. (0x2)
[0714/170730:ERROR:process_win.cc(134)] Unable to terminate process: Access is denied. (0x5)
[0714/170730:WARNING:ipc_channel_win.cc(276)] Unable to create pipe "\.pipechrome.5432.2.118634471" in client mode: The system cannot find the file specified. (0x2)
[0714/170742:ERROR:process_win.cc(134)] Unable to terminate process: Access is denied. (0x5)
[0714/170742:WARNING:ipc_channel_win.cc(276)] Unable to create pipe "\.pipechrome.5432.3.396064" in client mode: The system cannot find the file specified. (0x2)
下面是我启动cefclient的方法:
void MyCefApp::start() {
this->browserHandler = new client::ClientAppBrowser();
this->browserThread = boost::thread(boost::bind(&MyCefApp::run, this));
}
void MyCefApp::run() {
CefMainArgs mainArgs(GetModuleHandle(nullptr));
void* sandboxInfo = nullptr;
#if defined(CEF_USE_SANDBOX)
CefScopedSandboxInfo scopedSandbox;
sandboxInfo = scopedSandbox.sandbox_info();
#endif
CefRefPtr<CefCommandLine> commandLine = CefCommandLine::CreateCommandLine();
commandLine->InitFromString(::GetCommandLineW());
scoped_ptr<client::MainContextImpl> context(new client::MainContextImpl(commandLine, true));
CefSettings settings;
CefString(&settings.resources_dir_path) = RESOURCES_DIR_PATH;
CefString(&settings.locales_dir_path) = LOCALES_DIR_PATH;
#if !defined(CEF_USE_SANDBOX)
settings.no_sandbox = true;
#endif
context->PopulateSettings(&settings);
scoped_ptr<client::MainMessageLoop> messageLoop;
if (settings.multi_threaded_message_loop) {
messageLoop.reset(new client::MainMessageLoopMultithreadedWin);
} else {
messageLoop.reset(new client::MainMessageLoopStd);
}
context->Initialize(mainArgs, settings, this->browserHandler, sandboxInfo);
client::test_runner::RegisterSchemeHandlers();
context->GetRootWindowManager()->CreateRootWindow(
true,
settings.windowless_rendering_enabled ? true : false,
CefRect(),
std::string());
int result = messageLoop->Run();
context->Shutdown();
messageLoop.reset();
context.reset();
}
我在windows(8.1)上运行应用程序,而不是使用沙盒模式。
你知道这里发生了什么,为什么吗?
谢谢。
编辑
在main函数中,我检查进程类型:
if (MyCefApp::IsCefProcess()) {
return MyCefApp::RunCefProcess();
}
如果它确实是一个CEF进程(这意味着它不是client::ClientApp::BrowserProcess),那么我做:
int MyCefApp::RunCefProcess() {
CefMainArgs mainArgs(GetModuleHandle(nullptr));
void* sandboxInfo = nullptr;
CefRefPtr<CefApp> handler;
switch (GetProcessType()) {
case client::ClientApp::RendererProcess:
handler = new client::ClientAppRenderer();
break;
case client::ClientApp::OtherProcess:
handler = new client::ClientAppOther();
break;
}
return CefExecuteProcess(mainArgs, handler.get(), sandboxInfo);
}
这是一个与我所见过的或我们使用的示例非常不同的启动,但我没有看到的主要内容是调用CefExecuteProcess();
CefExecuteProcess是启动Renderer和其他子进程所必需的。没有这些,主浏览器试图连接的管道将不存在。除非从您的其他函数之一调用,否则您的客户端将无法工作
相关文章:
- 如何创建一个CMake变量,除非显式重写,否则使用默认值
- 使用std::multimap迭代器创建std::list
- 在全局变量中保存类的实例以重新创建类(创建"backup")
- 如何创建函数管道,以便函数一个接一个地运行?
- GLib-ERROR:为GWakeup创建管道:打开的文件太多
- gStreamer 将元素添加到通过 gst_parse_launch 创建的管道中
- 使用提升连接已创建的命名管道
- 创建名为管道错误
- 创建一个可以在没有实验的情况下变形的管道::任何
- 用管道在C++中创建调度队列/线程处理程序:FIFO溢出
- 我应该使用 DeviceContext 函数在管道中循环输入还是通过创建来输入
- 从管道中创建(或传递)字符串
- 在使用pthread_create创建的线程之间读取和写入管道时,是否需要关闭 fds
- 为 Intranet 主机创建C++命名管道
- 尝试创建命名管道失败并显示ERROR_IS_SUBSTED
- 进程,无法创建管道
- 管道ppm文件到ffmpeg在c++中创建电影
- 无法使用cefclient创建管道
- 命名管道错误:无法创建带有错误0x0000007b的命名管道
- 如何在c++中创建管道