- Revision
- 100756
- Author
- [email protected]
- Date
- 2011-11-18 05:29:22 -0800 (Fri, 18 Nov 2011)
Log Message
Web Inspector: dispatch messages from the front-end to the backend asynchronously.
https://bugs.webkit.org/show_bug.cgi?id=72621
Source/WebCore:
We should align the way we dispatch messages from the front-end to backend across the environments:
- WebKit has it synchronoulsly
- Chromium has it asynchronously
- Remote debugging has it asynchronously
Making it asynchronous made a number of flaky Qt tests pass.
Tests uncovered console agent problem that was also fixed.
Reviewed by Yury Semikhatsky.
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::clearFrontend):
* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorBackendDispatchTask::InspectorBackendDispatchTask):
(WebCore::InspectorBackendDispatchTask::dispatch):
(WebCore::InspectorBackendDispatchTask::reset):
(WebCore::InspectorBackendDispatchTask::onTimer):
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
(WebCore::InspectorFrontendClientLocal::windowObjectCleared):
(WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
* inspector/InspectorFrontendClientLocal.h:
Source/WebKit/chromium:
Reviewed by Yury Semikhatsky.
* src/InspectorFrontendClientImpl.cpp:
(WebKit::InspectorFrontendClientImpl::performDisconnectFromBackend):
* src/InspectorFrontendClientImpl.h:
LayoutTests:
Now that dispatching is asynchronous, timeline test needed a fix.
Reviewed by Yury Semikhatsky.
* inspector/timeline/timeline-script-tag-1.html:
* platform/qt/Skipped:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (100755 => 100756)
--- trunk/LayoutTests/ChangeLog 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/LayoutTests/ChangeLog 2011-11-18 13:29:22 UTC (rev 100756)
@@ -1,3 +1,15 @@
+2011-11-17 Pavel Feldman <[email protected]>
+
+ Web Inspector: dispatch messages from the front-end to the backend asynchronously.
+ https://bugs.webkit.org/show_bug.cgi?id=72621
+
+ Now that dispatching is asynchronous, timeline test needed a fix.
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/timeline/timeline-script-tag-1.html:
+ * platform/qt/Skipped:
+
2011-11-18 Sergio Villar Senin <[email protected]>
[GTK][WK2] Invalid TestNetscapePlugin path when using new-run-webkit-tests
Modified: trunk/LayoutTests/inspector/timeline/timeline-script-tag-1.html (100755 => 100756)
--- trunk/LayoutTests/inspector/timeline/timeline-script-tag-1.html 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/LayoutTests/inspector/timeline/timeline-script-tag-1.html 2011-11-18 13:29:22 UTC (rev 100756)
@@ -27,11 +27,19 @@
function step3()
{
- function format(record) {
+ function format(record)
+ {
if (record.type === WebInspector.TimelineAgent.RecordType.EvaluateScript)
InspectorTest.printTimelineRecordProperties(record);
- else if (record.type === WebInspector.TimelineAgent.RecordType.ParseHTML)
+ else if (record.type === WebInspector.TimelineAgent.RecordType.ParseHTML) {
+ var children = [];
+ for (var i = 0; i < record.children.length; ++i) {
+ if (record.children[i].type !== WebInspector.TimelineAgent.RecordType.RecalculateStyles)
+ children.push(record.children[i]);
+ }
+ record.children = children;
InspectorTest.dumpTimelineRecord(record);
+ }
}
InspectorTest.printTimelineRecords(null, format);
InspectorTest.completeTest();
Modified: trunk/Source/WebCore/ChangeLog (100755 => 100756)
--- trunk/Source/WebCore/ChangeLog 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/Source/WebCore/ChangeLog 2011-11-18 13:29:22 UTC (rev 100756)
@@ -1,3 +1,31 @@
+2011-11-17 Pavel Feldman <[email protected]>
+
+ Web Inspector: dispatch messages from the front-end to the backend asynchronously.
+ https://bugs.webkit.org/show_bug.cgi?id=72621
+
+ We should align the way we dispatch messages from the front-end to backend across the environments:
+ - WebKit has it synchronoulsly
+ - Chromium has it asynchronously
+ - Remote debugging has it asynchronously
+ Making it asynchronous made a number of flaky Qt tests pass.
+
+ Tests uncovered console agent problem that was also fixed.
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/InspectorConsoleAgent.cpp:
+ (WebCore::InspectorConsoleAgent::clearFrontend):
+ * inspector/InspectorFrontendClient.h:
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorBackendDispatchTask::InspectorBackendDispatchTask):
+ (WebCore::InspectorBackendDispatchTask::dispatch):
+ (WebCore::InspectorBackendDispatchTask::reset):
+ (WebCore::InspectorBackendDispatchTask::onTimer):
+ (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
+ (WebCore::InspectorFrontendClientLocal::windowObjectCleared):
+ (WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
+ * inspector/InspectorFrontendClientLocal.h:
+
2011-11-18 Iain Merrick <[email protected]>
[chromium] Pass screen refresh rate into compositor.
Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp (100755 => 100756)
--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp 2011-11-18 13:29:22 UTC (rev 100756)
@@ -135,6 +135,7 @@
void InspectorConsoleAgent::clearFrontend()
{
m_frontend = 0;
+ m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false);
}
void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (100755 => 100756)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2011-11-18 13:29:22 UTC (rev 100756)
@@ -45,6 +45,8 @@
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
#include "Settings.h"
+#include "Timer.h"
+#include <wtf/Deque.h>
namespace WebCore {
@@ -53,6 +55,42 @@
static const float minimumAttachedHeight = 250.0f;
static const float maximumAttachedHeightRatio = 0.75f;
+class InspectorBackendDispatchTask {
+public:
+ InspectorBackendDispatchTask(InspectorController* inspectorController)
+ : m_inspectorController(inspectorController)
+ , m_timer(this, &InspectorBackendDispatchTask::onTimer)
+ {
+ }
+
+ void dispatch(const String& message)
+ {
+ m_messages.append(message);
+ if (!m_timer.isActive())
+ m_timer.startOneShot(0);
+ }
+
+ void reset()
+ {
+ m_messages.clear();
+ m_timer.stop();
+ }
+
+ void onTimer(Timer<InspectorBackendDispatchTask>*)
+ {
+ if (!m_messages.isEmpty()) {
+ // Dispatch can lead to the timer destruction -> schedule the next shot first.
+ m_timer.startOneShot(0);
+ m_inspectorController->dispatchMessageFromFrontend(m_messages.takeFirst());
+ }
+ }
+
+private:
+ InspectorController* m_inspectorController;
+ Timer<InspectorBackendDispatchTask> m_timer;
+ Deque<String> m_messages;
+};
+
String InspectorFrontendClientLocal::Settings::getProperty(const String&)
{
return String();
@@ -69,6 +107,7 @@
, m_settings(settings)
{
m_frontendPage->settings()->setAllowFileAccessFromFileURLs(true);
+ m_dispatchTask = adoptPtr(new InspectorBackendDispatchTask(inspectorController));
}
InspectorFrontendClientLocal::~InspectorFrontendClientLocal()
@@ -163,7 +202,7 @@
void InspectorFrontendClientLocal::sendMessageToBackend(const String& message)
{
- m_inspectorController->dispatchMessageFromFrontend(message);
+ m_dispatchTask->dispatch(message);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (100755 => 100756)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2011-11-18 13:29:22 UTC (rev 100756)
@@ -39,6 +39,7 @@
namespace WebCore {
class InspectorController;
+class InspectorBackendDispatchTask;
class InspectorFrontendHost;
class Page;
@@ -88,6 +89,7 @@
// TODO(yurys): this ref shouldn't be needed.
RefPtr<InspectorFrontendHost> m_frontendHost;
OwnPtr<InspectorFrontendClientLocal::Settings> m_settings;
+ OwnPtr<InspectorBackendDispatchTask> m_dispatchTask;
};
} // namespace WebCore
Modified: trunk/Source/WebKit/chromium/ChangeLog (100755 => 100756)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-11-18 13:28:21 UTC (rev 100755)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-11-18 13:29:22 UTC (rev 100756)
@@ -1,3 +1,14 @@
+2011-11-17 Pavel Feldman <[email protected]>
+
+ Web Inspector: dispatch messages from the front-end to the backend asynchronously.
+ https://bugs.webkit.org/show_bug.cgi?id=72621
+
+ Reviewed by Yury Semikhatsky.
+
+ * src/InspectorFrontendClientImpl.cpp:
+ (WebKit::InspectorFrontendClientImpl::performDisconnectFromBackend):
+ * src/InspectorFrontendClientImpl.h:
+
2011-11-18 Iain Merrick <[email protected]>
[chromium] Pass screen refresh rate into compositor.