Commit ab3324de authored by dgozman's avatar dgozman Committed by Commit bot

[DevTools] DCHECK that DevToolsAgentHostClientImpl is operated on UI.

This is to ensure that threading is not the cause of http handler crashes.

BUG=none
TBR=pfeldman@chromium.org

Review URL: https://codereview.chromium.org/1138323003

Cr-Commit-Position: refs/heads/master@{#330340}
parent b2da245a
...@@ -268,16 +268,19 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient { ...@@ -268,16 +268,19 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient {
server_wrapper_(server_wrapper), server_wrapper_(server_wrapper),
connection_id_(connection_id), connection_id_(connection_id),
agent_host_(agent_host) { agent_host_(agent_host) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
agent_host_->AttachClient(this); agent_host_->AttachClient(this);
} }
~DevToolsAgentHostClientImpl() override { ~DevToolsAgentHostClientImpl() override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (agent_host_.get()) if (agent_host_.get())
agent_host_->DetachClient(); agent_host_->DetachClient();
} }
void AgentHostClosed(DevToolsAgentHost* agent_host, void AgentHostClosed(DevToolsAgentHost* agent_host,
bool replaced_with_another_client) override { bool replaced_with_another_client) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(agent_host == agent_host_.get()); DCHECK(agent_host == agent_host_.get());
std::string message = base::StringPrintf( std::string message = base::StringPrintf(
...@@ -297,6 +300,7 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient { ...@@ -297,6 +300,7 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient {
void DispatchProtocolMessage(DevToolsAgentHost* agent_host, void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
const std::string& message) override { const std::string& message) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(agent_host == agent_host_.get()); DCHECK(agent_host == agent_host_.get());
message_loop_->PostTask( message_loop_->PostTask(
FROM_HERE, FROM_HERE,
...@@ -307,6 +311,7 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient { ...@@ -307,6 +311,7 @@ class DevToolsAgentHostClientImpl : public DevToolsAgentHostClient {
} }
void OnMessage(const std::string& message) { void OnMessage(const std::string& message) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (agent_host_.get()) if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message); agent_host_->DispatchProtocolMessage(message);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment