summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp')
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
index afeb1723e..46c452cba 100644
--- a/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2012 Samsung Electronics Ltd. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,12 +27,53 @@
#include "config.h"
#include "WebContext.h"
+
+#include "Logging.h"
+#include "WebInspectorServer.h"
#include <WebCore/FileSystem.h>
#include <WebCore/NotImplemented.h>
#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/text/CString.h>
namespace WebKit {
+static void initInspectorServer()
+{
+#if ENABLE(INSPECTOR_SERVER)
+ static bool initialized = false;
+ if (initialized)
+ return;
+
+ initialized = true;
+ String serverAddress(g_getenv("WEBKIT_INSPECTOR_SERVER"));
+
+ if (!serverAddress.isNull()) {
+ String bindAddress = "127.0.0.1";
+ unsigned short port = 2999;
+
+ Vector<String> result;
+ serverAddress.split(":", result);
+
+ if (result.size() == 2) {
+ bindAddress = result[0];
+ bool ok = false;
+ port = result[1].toInt(&ok);
+ if (!ok) {
+ port = 2999;
+ LOG_ERROR("Couldn't parse the port. Use 2999 instead.");
+ }
+ } else
+ LOG_ERROR("Couldn't parse %s, wrong format? Use 127.0.0.1:2999 instead.", serverAddress.utf8().data());
+
+ if (!WebInspectorServer::shared().listen(bindAddress, port))
+ LOG_ERROR("Couldn't start listening on: IP address=%s, port=%d.", bindAddress.utf8().data(), port);
+ return;
+ }
+
+ LOG(InspectorServer, "To start inspector server set WEBKIT_INSPECTOR_SERVER to 127.0.0.1:2999 for example.");
+#endif
+}
+
WTF::String WebContext::applicationCacheDirectory()
{
GOwnPtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "webkitgtk", "applications", NULL));
@@ -40,6 +82,7 @@ WTF::String WebContext::applicationCacheDirectory()
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
{
+ initInspectorServer();
}
void WebContext::platformInvalidateContext()