Fix crash on DevTools remote debugging of WebWorkers (fixes issue #2605)

This commit is contained in:
Marshall Greenblatt 2019-07-26 09:47:11 -04:00
parent 2d8d064ce8
commit ccb06ce3cb
1 changed files with 18 additions and 2 deletions

View File

@ -648,12 +648,28 @@ void CefContentRendererClient::RunScriptsAtDocumentIdle(
}
void CefContentRendererClient::DevToolsAgentAttached() {
CEF_REQUIRE_RT();
// WebWorkers may be creating agents on a different thread.
if (!render_task_runner_->BelongsToCurrentThread()) {
render_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&CefContentRendererClient::DevToolsAgentAttached,
base::Unretained(this)));
return;
}
++devtools_agent_count_;
}
void CefContentRendererClient::DevToolsAgentDetached() {
CEF_REQUIRE_RT();
// WebWorkers may be creating agents on a different thread.
if (!render_task_runner_->BelongsToCurrentThread()) {
render_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&CefContentRendererClient::DevToolsAgentDetached,
base::Unretained(this)));
return;
}
--devtools_agent_count_;
if (devtools_agent_count_ == 0 && uncaught_exception_stack_size_ > 0) {
// When the last DevToolsAgent is detached the stack size is set to 0.