Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: components/devtools_service/devtools_agent_host.cc

Issue 1164383002: Mandoline DevTools service: remote debugging protocol over HTTP/WebSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/devtools_service/devtools_agent_host.h"
6
7 #include "base/guid.h"
8 #include "base/logging.h"
9
10 namespace devtools_service {
11
12 DevToolsAgentHost::DevToolsAgentHost(DevToolsAgentPtr agent)
13 : id_(base::GenerateGUID()),
14 agent_(agent.Pass()),
15 binding_(this),
16 delegate_(nullptr) {
17 DCHECK(agent_);
jam 2015/06/09 22:21:21 nit: this is redundant since the next line will gi
yzshen1 2015/06/10 15:34:39 Done.
18 agent_.set_error_handler(this);
19 }
20
21 DevToolsAgentHost::~DevToolsAgentHost() {
22 if (delegate_)
23 delegate_->OnAgentHostClosed(this);
24 }
25
26 void DevToolsAgentHost::SetDelegate(Delegate* delegate) {
27 delegate_ = delegate;
28 if (delegate_) {
29 if (binding_.is_bound())
30 return;
31
32 DevToolsAgentClientPtr client;
33 binding_.Bind(&client);
34 agent_->SetClient(client.Pass(), id_);
35 } else {
36 if (!binding_.is_bound())
37 return;
38
39 binding_.Close();
40 }
41 }
42
43 void DevToolsAgentHost::SendProtocolMessageToAgent(const std::string& message) {
44 agent_->DispatchProtocolMessage(message);
45 }
46
47 void DevToolsAgentHost::DispatchProtocolMessage(const mojo::String& message) {
48 DCHECK(delegate_);
jam 2015/06/09 22:21:21 ditto
yzshen1 2015/06/10 15:34:39 Done.
49 delegate_->DispatchProtocolMessage(this, message);
50 }
51
52 void DevToolsAgentHost::OnConnectionError() {
53 agent_connection_error_handler_.Run();
54 }
55
56 } // namespace devtools_service
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698