Index: content/browser/devtools/protocol/tethering_handler.cc |
diff --git a/content/browser/devtools/protocol/tethering_handler.cc b/content/browser/devtools/protocol/tethering_handler.cc |
index 9b964f49d3827def0c320424d60f6cd74f7a6501..c5bd536effbc64d5335f650be15f2ffd3d3023c8 100644 |
--- a/content/browser/devtools/protocol/tethering_handler.cc |
+++ b/content/browser/devtools/protocol/tethering_handler.cc |
@@ -238,12 +238,13 @@ class TetheringHandler::TetheringImpl { |
const CreateServerSocketCallback& socket_callback); |
~TetheringImpl(); |
- void Bind(DevToolsCommandId command_id, uint16 port); |
- void Unbind(DevToolsCommandId command_id, uint16 port); |
+ void Bind(int session_id, DevToolsCommandId command_id, uint16 port); |
+ void Unbind(int session_id, DevToolsCommandId command_id, uint16 port); |
void Accepted(uint16 port, const std::string& name); |
private: |
- void SendInternalError(DevToolsCommandId command_id, |
+ void SendInternalError(int session_id, |
+ DevToolsCommandId command_id, |
const std::string& message); |
base::WeakPtr<TetheringHandler> handler_; |
@@ -264,10 +265,11 @@ TetheringHandler::TetheringImpl::~TetheringImpl() { |
STLDeleteValues(&bound_sockets_); |
} |
-void TetheringHandler::TetheringImpl::Bind( |
- DevToolsCommandId command_id, uint16 port) { |
+void TetheringHandler::TetheringImpl::Bind(int session_id, |
+ DevToolsCommandId command_id, |
+ uint16 port) { |
if (bound_sockets_.find(port) != bound_sockets_.end()) { |
- SendInternalError(command_id, "Port already bound"); |
+ SendInternalError(session_id, command_id, "Port already bound"); |
return; |
} |
@@ -276,32 +278,30 @@ void TetheringHandler::TetheringImpl::Bind( |
scoped_ptr<BoundSocket> bound_socket( |
new BoundSocket(callback, socket_callback_)); |
if (!bound_socket->Listen(port)) { |
- SendInternalError(command_id, "Could not bind port"); |
+ SendInternalError(session_id, command_id, "Could not bind port"); |
return; |
} |
bound_sockets_[port] = bound_socket.release(); |
- BrowserThread::PostTask( |
- BrowserThread::UI, |
- FROM_HERE, |
- base::Bind(&TetheringHandler::SendBindSuccess, handler_, command_id)); |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&TetheringHandler::SendBindSuccess, |
+ handler_, session_id, command_id)); |
} |
-void TetheringHandler::TetheringImpl::Unbind( |
- DevToolsCommandId command_id, uint16 port) { |
- |
+void TetheringHandler::TetheringImpl::Unbind(int session_id, |
+ DevToolsCommandId command_id, |
+ uint16 port) { |
BoundSockets::iterator it = bound_sockets_.find(port); |
if (it == bound_sockets_.end()) { |
- SendInternalError(command_id, "Port is not bound"); |
+ SendInternalError(session_id, command_id, "Port is not bound"); |
return; |
} |
delete it->second; |
bound_sockets_.erase(it); |
- BrowserThread::PostTask( |
- BrowserThread::UI, |
- FROM_HERE, |
- base::Bind(&TetheringHandler::SendUnbindSuccess, handler_, command_id)); |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&TetheringHandler::SendUnbindSuccess, |
+ handler_, session_id, command_id)); |
} |
void TetheringHandler::TetheringImpl::Accepted( |
@@ -313,12 +313,12 @@ void TetheringHandler::TetheringImpl::Accepted( |
} |
void TetheringHandler::TetheringImpl::SendInternalError( |
+ int session_id, |
DevToolsCommandId command_id, |
const std::string& message) { |
BrowserThread::PostTask( |
- BrowserThread::UI, |
- FROM_HERE, |
- base::Bind(&TetheringHandler::SendInternalError, handler_, |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&TetheringHandler::SendInternalError, handler_, session_id, |
command_id, message)); |
} |
@@ -363,7 +363,9 @@ bool TetheringHandler::Activate() { |
return true; |
} |
-Response TetheringHandler::Bind(DevToolsCommandId command_id, int port) { |
+Response TetheringHandler::Bind(int session_id, |
+ DevToolsCommandId command_id, |
+ int port) { |
if (port < kMinTetheringPort || port > kMaxTetheringPort) |
return Response::InvalidParams("port"); |
@@ -373,32 +375,37 @@ Response TetheringHandler::Bind(DevToolsCommandId command_id, int port) { |
DCHECK(impl_); |
task_runner_->PostTask( |
FROM_HERE, base::Bind(&TetheringImpl::Bind, base::Unretained(impl_), |
- command_id, port)); |
+ session_id, command_id, port)); |
return Response::OK(); |
} |
-Response TetheringHandler::Unbind(DevToolsCommandId command_id, int port) { |
+Response TetheringHandler::Unbind(int session_id, |
+ DevToolsCommandId command_id, |
+ int port) { |
if (!Activate()) |
return Response::ServerError("Tethering is used by another connection"); |
DCHECK(impl_); |
task_runner_->PostTask( |
FROM_HERE, base::Bind(&TetheringImpl::Unbind, base::Unretained(impl_), |
- command_id, port)); |
+ session_id, command_id, port)); |
return Response::OK(); |
} |
-void TetheringHandler::SendBindSuccess(DevToolsCommandId command_id) { |
- client_->SendBindResponse(command_id, BindResponse::Create()); |
+void TetheringHandler::SendBindSuccess(int session_id, |
+ DevToolsCommandId command_id) { |
+ client_->SendBindResponse(session_id, command_id, BindResponse::Create()); |
} |
-void TetheringHandler::SendUnbindSuccess(DevToolsCommandId command_id) { |
- client_->SendUnbindResponse(command_id, UnbindResponse::Create()); |
+void TetheringHandler::SendUnbindSuccess(int session_id, |
+ DevToolsCommandId command_id) { |
+ client_->SendUnbindResponse(session_id, command_id, UnbindResponse::Create()); |
} |
-void TetheringHandler::SendInternalError(DevToolsCommandId command_id, |
+void TetheringHandler::SendInternalError(int session_id, |
+ DevToolsCommandId command_id, |
const std::string& message) { |
- client_->SendError(command_id, Response::InternalError(message)); |
+ client_->SendError(session_id, command_id, Response::InternalError(message)); |
} |
} // namespace tethering |