OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromecast/browser/devtools/remote_debugging_server.h" | 5 #include "chromecast/browser/devtools/remote_debugging_server.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 VLOG(1) << "OnPortChanged called: old_port=" << port_ | 122 VLOG(1) << "OnPortChanged called: old_port=" << port_ |
123 << ", new_port=" << new_port; | 123 << ", new_port=" << new_port; |
124 | 124 |
125 if (new_port == port_) { | 125 if (new_port == port_) { |
126 VLOG(1) << "Port has not been changed. Ignore silently."; | 126 VLOG(1) << "Port has not been changed. Ignore silently."; |
127 return; | 127 return; |
128 } | 128 } |
129 | 129 |
130 if (devtools_http_handler_) { | 130 if (devtools_http_handler_) { |
131 LOG(INFO) << "Stop old devtools: port=" << port_; | 131 LOG(INFO) << "Stop old devtools: port=" << port_; |
132 // Note: Stop destroys devtools_http_handler_. | 132 devtools_http_handler_.reset(); |
133 devtools_http_handler_->Stop(); | |
134 devtools_http_handler_ = NULL; | |
135 } | 133 } |
136 | 134 |
137 port_ = new_port; | 135 port_ = new_port; |
138 if (port_ > 0) { | 136 if (port_ > 0) { |
139 devtools_http_handler_ = content::DevToolsHttpHandler::Start( | 137 devtools_http_handler_.reset(content::DevToolsHttpHandler::Start( |
140 CreateSocketFactory(port_), | 138 CreateSocketFactory(port_), |
141 GetFrontendUrl(), | 139 GetFrontendUrl(), |
142 new CastDevToolsDelegate(), | 140 new CastDevToolsDelegate(), |
143 base::FilePath()); | 141 base::FilePath())); |
144 LOG(INFO) << "Devtools started: port=" << port_; | 142 LOG(INFO) << "Devtools started: port=" << port_; |
145 } | 143 } |
146 } | 144 } |
147 | 145 |
148 } // namespace shell | 146 } // namespace shell |
149 } // namespace chromecast | 147 } // namespace chromecast |
OLD | NEW |