| Index: Source/core/testing/InspectorFrontendClientLocal.cpp
|
| diff --git a/Source/core/testing/InspectorFrontendClientLocal.cpp b/Source/core/testing/InspectorFrontendClientLocal.cpp
|
| index decd7d00020b63b0971707d9aa752e4624479d9c..e2c5af9bc459ddb11f38ad34bcfe35c5270b6eb8 100644
|
| --- a/Source/core/testing/InspectorFrontendClientLocal.cpp
|
| +++ b/Source/core/testing/InspectorFrontendClientLocal.cpp
|
| @@ -37,6 +37,8 @@
|
| #include "core/page/Page.h"
|
| #include "core/page/Settings.h"
|
| #include "core/platform/Timer.h"
|
| +#include "public/platform/Platform.h"
|
| +#include "public/platform/WebThread.h"
|
| #include <wtf/Deque.h>
|
| #include <wtf/text/WTFString.h>
|
|
|
| @@ -47,35 +49,41 @@ 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);
|
| + schedule();
|
| }
|
|
|
| - void reset()
|
| +private:
|
| + void schedule()
|
| {
|
| - m_messages.clear();
|
| - m_timer.stop();
|
| + class TaskImpl : public WebKit::WebThread::Task {
|
| + public:
|
| + InspectorBackendDispatchTask* owner;
|
| + virtual void run()
|
| + {
|
| + owner->onTimer();
|
| + }
|
| + };
|
| + TaskImpl* taskImpl = new TaskImpl;
|
| + taskImpl->owner = this;
|
| + WebKit::Platform::current()->currentThread()->postTask(taskImpl);
|
| }
|
|
|
| - void onTimer(Timer<InspectorBackendDispatchTask>*)
|
| + void onTimer()
|
| {
|
| if (!m_messages.isEmpty()) {
|
| // Dispatch can lead to the timer destruction -> schedule the next shot first.
|
| - m_timer.startOneShot(0);
|
| + schedule();
|
| m_inspectorController->dispatchMessageFromFrontend(m_messages.takeFirst());
|
| }
|
| }
|
|
|
| -private:
|
| InspectorController* m_inspectorController;
|
| - Timer<InspectorBackendDispatchTask> m_timer;
|
| Deque<String> m_messages;
|
| };
|
|
|
|
|