Commit 9451f95f authored by jam@chromium.org's avatar jam@chromium.org

Add --remote-debugging-port back to content_shell since nduca mentioned he...

Add --remote-debugging-port back to content_shell since nduca mentioned he wants to use it with Android.

BUG=90445
Review URL: https://chromiumcodereview.appspot.com/10829303

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151480 0039d316-1c4b-4281-b951-d872f2087c98
parent d1566aca
......@@ -1140,9 +1140,6 @@ const char kReloadKilledTabs[] = "reload-killed-tabs";
// Uses custom front-end URL for the remote debugging.
const char kRemoteDebuggingFrontend[] = "remote-debugging-frontend";
// Enables remote debug over HTTP on the specified port.
const char kRemoteDebuggingPort[] = "remote-debugging-port";
// Enables print preview in the renderer. This flag is generated internally by
// Chrome and does nothing when directly passed to the browser.
const char kRendererPrintPreview[] = "renderer-print-preview";
......
......@@ -303,7 +303,6 @@ extern const char kRecordStats[];
extern const char kRecordMode[];
extern const char kReloadKilledTabs[];
extern const char kRemoteDebuggingFrontend[];
extern const char kRemoteDebuggingPort[];
extern const char kRendererPrintPreview[];
extern const char kResetVariationState[];
extern const char kRestoreLastSession[];
......
......@@ -530,6 +530,9 @@ const char kProcessType[] = "type";
// Register Pepper plugins (see pepper_plugin_registry.cc for its format).
const char kRegisterPepperPlugins[] = "register-pepper-plugins";
// Enables remote debug over HTTP on the specified port.
const char kRemoteDebuggingPort[] = "remote-debugging-port";
// Causes the renderer process to throw an assertion on launch.
const char kRendererAssertTest[] = "renderer-assert-test";
......
......@@ -167,6 +167,7 @@ CONTENT_EXPORT extern const char kProcessPerSite[];
CONTENT_EXPORT extern const char kProcessPerTab[];
CONTENT_EXPORT extern const char kProcessType[];
CONTENT_EXPORT extern const char kRegisterPepperPlugins[];
CONTENT_EXPORT extern const char kRemoteDebuggingPort[];
CONTENT_EXPORT extern const char kRendererAssertTest[];
extern const char kRendererCmdPrefix[];
CONTENT_EXPORT extern const char kRendererProcess[];
......
......@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/common/content_switches.h"
......@@ -95,8 +96,26 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
Shell::PlatformInitialize();
net::NetModule::SetResourceProvider(PlatformResourceProvider);
int port = 0;
// On android the port number isn't used.
#if !defined(OS_ANDROID)
// See if the user specified a port on the command line (useful for
// automation). If not, use an ephemeral port by specifying 0.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
int temp_port;
std::string port_str =
command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
if (base::StringToInt(port_str, &temp_port) &&
temp_port > 0 && temp_port < 65535) {
port = temp_port;
} else {
DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
}
}
#endif
devtools_delegate_ = new ShellDevToolsDelegate(
browser_context_->GetRequestContext());
port, browser_context_->GetRequestContext());
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
Shell::CreateNewWindow(browser_context_.get(),
......
......@@ -14,10 +14,11 @@
namespace content {
ShellDevToolsDelegate::ShellDevToolsDelegate(
int port,
net::URLRequestContextGetter* context_getter)
: context_getter_(context_getter) {
devtools_http_handler_ = DevToolsHttpHandler::Start(
new net::TCPListenSocketFactory("127.0.0.1", 0),
new net::TCPListenSocketFactory("127.0.0.1", port),
"",
context_getter_,
this);
......
......@@ -21,7 +21,7 @@ class DevToolsHttpHandler;
class ShellDevToolsDelegate : public DevToolsHttpHandlerDelegate {
public:
explicit ShellDevToolsDelegate(net::URLRequestContextGetter* context_getter);
ShellDevToolsDelegate(int port, net::URLRequestContextGetter* context_getter);
virtual ~ShellDevToolsDelegate();
// Stops http server.
......
......@@ -28,6 +28,7 @@ const char kFrontEndURL[] =
namespace content {
ShellDevToolsDelegate::ShellDevToolsDelegate(
int port,
net::URLRequestContextGetter* context_getter)
: context_getter_(context_getter) {
devtools_http_handler_ = DevToolsHttpHandler::Start(
......
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