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 "base/bind.h" |
| 6 #include "base/bind_helpers.h" |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
7 #include "base/location.h" | |
8 #include "base/single_thread_task_runner.h" | |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 11 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
12 #include "chrome/browser/devtools/device/tcp_device_provider.h" | 12 #include "chrome/browser/devtools/device/tcp_device_provider.h" |
13 #include "chrome/browser/devtools/remote_debugging_server.h" | 13 #include "chrome/browser/devtools/remote_debugging_server.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 prefs->SetBoolean(prefs::kDevToolsPortForwardingEnabled, true); | 170 prefs->SetBoolean(prefs::kDevToolsPortForwardingEnabled, true); |
171 | 171 |
172 base::DictionaryValue config; | 172 base::DictionaryValue config; |
173 config.SetString( | 173 config.SetString( |
174 forwarding_port, original_url.host() + ":" + original_url.port()); | 174 forwarding_port, original_url.host() + ":" + original_url.port()); |
175 prefs->Set(prefs::kDevToolsPortForwardingConfig, config); | 175 prefs->Set(prefs::kDevToolsPortForwardingConfig, config); |
176 | 176 |
177 std::unique_ptr<Listener> wait_for_port_forwarding(new Listener(profile)); | 177 std::unique_ptr<Listener> wait_for_port_forwarding(new Listener(profile)); |
178 content::RunMessageLoop(); | 178 content::RunMessageLoop(); |
179 | 179 |
| 180 base::RunLoop run_loop; |
| 181 |
180 self_provider->set_release_callback_for_test( | 182 self_provider->set_release_callback_for_test( |
181 base::Bind(&base::MessageLoop::PostTask, | 183 base::Bind(base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), |
182 base::Unretained(base::MessageLoop::current()), FROM_HERE, | 184 base::ThreadTaskRunnerHandle::Get(), FROM_HERE, |
183 base::MessageLoop::QuitWhenIdleClosure())); | 185 run_loop.QuitWhenIdleClosure())); |
184 wait_for_port_forwarding.reset(); | 186 wait_for_port_forwarding.reset(); |
185 content::RunMessageLoop(); | 187 |
| 188 content::RunThisRunLoop(&run_loop); |
186 } | 189 } |
OLD | NEW |