[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
tkent at chromium.org
tkent at chromium.org
Wed Dec 22 12:57:58 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5bc345d353215ab693c1567030ad6517f309d00b
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 3 01:51:23 2010 +0000
2010-09-02 Kent Tamura <tkent at chromium.org>
Reviewed by Dimitri Glazkov.
[DRT/Chromium] Remove dependency to base/task.h and base/timer.h
https://bugs.webkit.org/show_bug.cgi?id=45091
* DEPS: Roll Chromium revision to 58277 in order to have
webkit_support::PostDelayedTask().
2010-09-02 Kent Tamura <tkent at chromium.org>
Reviewed by Dimitri Glazkov.
[DRT/Chromium] Remove dependency to base/task.h and base/timer.h
https://bugs.webkit.org/show_bug.cgi?id=45091
Task.{cpp,h} introduces a simpler version of Chromium
base/task.h. It doesn't have TupleN and Method.
* DumpRenderTree/DumpRenderTree.gypi:
Add Task.cpp and Task.h
* DumpRenderTree/chromium/DRTDevToolsAgent.cpp:
(DRTDevToolsAgent::DRTDevToolsAgent):
(DRTDevToolsAgent::reset):
(DRTDevToolsAgent::asyncCall):
(DRTDevToolsAgent::frontendLoaded):
* DumpRenderTree/chromium/DRTDevToolsAgent.h:
(DRTDevToolsAgent::taskList): Added to use MethodTask<T>.
* DumpRenderTree/chromium/DRTDevToolsClient.cpp:
(DRTDevToolsClient::DRTDevToolsClient):
(DRTDevToolsClient::~DRTDevToolsClient):
(DRTDevToolsClient::reset):
(DRTDevToolsClient::asyncCall):
* DumpRenderTree/chromium/DRTDevToolsClient.h:
(DRTDevToolsClient::taskList): Added to use MethodTask<T>.
* DumpRenderTree/chromium/EventSender.cpp:
(EventSender::EventSender):
(EventSender::reset):
(EventSender::scheduleAsynchronousClick):
* DumpRenderTree/chromium/EventSender.h:
(EventSender::taskList): Added to use MethodTask<T>.
* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::WorkQueue::processWorkSoon):
(LayoutTestController::waitUntilDone):
(LayoutTestController::notifyDone):
(LayoutTestController::reset):
* DumpRenderTree/chromium/LayoutTestController.h:
(LayoutTestController::taskList): Added to use MethodTask<T>.
(LayoutTestController::WorkQueue::taskList): Added to use MethodTask<T>.
* DumpRenderTree/chromium/NotificationPresenter.cpp:
(deferredDisplayDispatch):
(NotificationPresenter::show):
* DumpRenderTree/chromium/Task.cpp: Added.
* DumpRenderTree/chromium/Task.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 527e8ef..bffb243 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-02 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Remove dependency to base/task.h and base/timer.h
+ https://bugs.webkit.org/show_bug.cgi?id=45091
+
+ * DEPS: Roll Chromium revision to 58277 in order to have
+ webkit_support::PostDelayedTask().
+
2010-09-02 Ilya Sherman <isherman at google.com>
Reviewed by Eric Seidel.
diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS
index 6252f08..2fc218b 100644
--- a/WebKit/chromium/DEPS
+++ b/WebKit/chromium/DEPS
@@ -32,7 +32,7 @@
vars = {
'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
- 'chromium_rev': '57823',
+ 'chromium_rev': '58277',
}
deps = {
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index a591d92..0059320 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,50 @@
+2010-09-02 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ [DRT/Chromium] Remove dependency to base/task.h and base/timer.h
+ https://bugs.webkit.org/show_bug.cgi?id=45091
+
+ Task.{cpp,h} introduces a simpler version of Chromium
+ base/task.h. It doesn't have TupleN and Method.
+
+ * DumpRenderTree/DumpRenderTree.gypi:
+ Add Task.cpp and Task.h
+ * DumpRenderTree/chromium/DRTDevToolsAgent.cpp:
+ (DRTDevToolsAgent::DRTDevToolsAgent):
+ (DRTDevToolsAgent::reset):
+ (DRTDevToolsAgent::asyncCall):
+ (DRTDevToolsAgent::frontendLoaded):
+ * DumpRenderTree/chromium/DRTDevToolsAgent.h:
+ (DRTDevToolsAgent::taskList): Added to use MethodTask<T>.
+ * DumpRenderTree/chromium/DRTDevToolsClient.cpp:
+ (DRTDevToolsClient::DRTDevToolsClient):
+ (DRTDevToolsClient::~DRTDevToolsClient):
+ (DRTDevToolsClient::reset):
+ (DRTDevToolsClient::asyncCall):
+ * DumpRenderTree/chromium/DRTDevToolsClient.h:
+ (DRTDevToolsClient::taskList): Added to use MethodTask<T>.
+ * DumpRenderTree/chromium/EventSender.cpp:
+ (EventSender::EventSender):
+ (EventSender::reset):
+ (EventSender::scheduleAsynchronousClick):
+ * DumpRenderTree/chromium/EventSender.h:
+ (EventSender::taskList): Added to use MethodTask<T>.
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::WorkQueue::processWorkSoon):
+ (LayoutTestController::waitUntilDone):
+ (LayoutTestController::notifyDone):
+ (LayoutTestController::reset):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ (LayoutTestController::taskList): Added to use MethodTask<T>.
+ (LayoutTestController::WorkQueue::taskList): Added to use MethodTask<T>.
+ * DumpRenderTree/chromium/NotificationPresenter.cpp:
+ (deferredDisplayDispatch):
+ (NotificationPresenter::show):
+ * DumpRenderTree/chromium/Task.cpp: Added.
+ * DumpRenderTree/chromium/Task.h: Added.
+
2010-09-02 Steve Block <steveblock at google.com>
Reviewed by Adam Barth.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
index a525532..b39fd2a 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi
@@ -26,6 +26,8 @@
'chromium/NotificationPresenter.cpp',
'chromium/PlainTextController.cpp',
'chromium/PlainTextController.h',
+ 'chromium/Task.h',
+ 'chromium/Task.cpp',
'chromium/TestEventPrinter.h',
'chromium/TestEventPrinter.cpp',
'chromium/TestNavigationController.cpp',
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
index ba1edd7..66d894c 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
@@ -43,8 +43,7 @@
using namespace WebKit;
DRTDevToolsAgent::DRTDevToolsAgent()
- : m_callMethodFactory(this)
- , m_drtDevToolsClient(0)
+ : m_drtDevToolsClient(0)
, m_webView(0)
{
static int devToolsAgentCounter = 0;
@@ -56,7 +55,7 @@ DRTDevToolsAgent::DRTDevToolsAgent()
void DRTDevToolsAgent::reset()
{
- m_callMethodFactory.RevokeAll();
+ m_taskList.revokeAll();
}
void DRTDevToolsAgent::setWebView(WebView* webView)
@@ -89,10 +88,9 @@ WebDevToolsAgentClient::WebKitClientMessageLoop* DRTDevToolsAgent::createClientM
return webkit_support::CreateDevToolsMessageLoop();
}
-void DRTDevToolsAgent::asyncCall(const DRTDevToolsCallArgs &args)
+void DRTDevToolsAgent::asyncCall(const DRTDevToolsCallArgs& args)
{
- webkit_support::PostTaskFromHere(
- m_callMethodFactory.NewRunnableMethod(&DRTDevToolsAgent::call, args));
+ postTask(new AsyncCallTask(this, args));
}
void DRTDevToolsAgent::call(const DRTDevToolsCallArgs &args)
@@ -137,9 +135,9 @@ void DRTDevToolsAgent::detach()
m_drtDevToolsClient = 0;
}
-void DRTDevToolsAgent::frontendLoaded() {
- webkit_support::PostTaskFromHere(
- m_callMethodFactory.NewRunnableMethod(&DRTDevToolsAgent::delayedFrontendLoaded));
+void DRTDevToolsAgent::frontendLoaded()
+{
+ postTask(new DelayedFrontendLoadedTask(this));
}
bool DRTDevToolsAgent::setTimelineProfilingEnabled(bool enabled)
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
index 8747cea..f9ec20f 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
@@ -31,7 +31,8 @@
#ifndef DRTDevToolsAgent_h
#define DRTDevToolsAgent_h
-#include "base/task.h" // FIXME: remove this
+#include "DRTDevToolsCallArgs.h"
+#include "Task.h"
#include "public/WebDevToolsAgentClient.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
@@ -46,7 +47,6 @@ struct WebDevToolsMessageData;
} // namespace WebKit
-class DRTDevToolsCallArgs;
class DRTDevToolsClient;
class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient
@@ -74,6 +74,7 @@ public:
bool evaluateInWebInspector(long callID, const std::string& script);
bool setTimelineProfilingEnabled(bool enable);
+ TaskList* taskList() { return &m_taskList; }
private:
void call(const DRTDevToolsCallArgs&);
@@ -81,7 +82,21 @@ private:
static void dispatchMessageLoop();
WebKit::WebDevToolsAgent* webDevToolsAgent();
- ScopedRunnableMethodFactory<DRTDevToolsAgent> m_callMethodFactory;
+ class AsyncCallTask: public MethodTask<DRTDevToolsAgent> {
+ public:
+ AsyncCallTask(DRTDevToolsAgent* object, const DRTDevToolsCallArgs& args)
+ : MethodTask<DRTDevToolsAgent>(object), m_args(args) {}
+ virtual void runIfValid() { m_object->call(m_args); }
+ private:
+ DRTDevToolsCallArgs m_args;
+ };
+
+ struct DelayedFrontendLoadedTask: public MethodTask<DRTDevToolsAgent> {
+ DelayedFrontendLoadedTask(DRTDevToolsAgent* object) : MethodTask<DRTDevToolsAgent>(object) {}
+ virtual void runIfValid() { m_object->delayedFrontendLoaded(); }
+ };
+
+ TaskList m_taskList;
DRTDevToolsClient* m_drtDevToolsClient;
int m_routingID;
WebKit::WebDevToolsAgent* m_webDevToolsAgent;
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
index 42f3724..a53f0db 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
@@ -45,8 +45,7 @@
using namespace WebKit;
DRTDevToolsClient::DRTDevToolsClient(DRTDevToolsAgent* agent, WebView* webView)
- : m_callMethodFactory(this)
- , m_drtDevToolsAgent(agent)
+ : m_drtDevToolsAgent(agent)
, m_webView(webView)
{
m_webDevToolsFrontend.set(WebDevToolsFrontend::create(m_webView,
@@ -59,14 +58,14 @@ DRTDevToolsClient::~DRTDevToolsClient()
{
// There is a chance that the page will be destroyed at detach step of
// m_drtDevToolsAgent and we should clean pending requests a bit earlier.
- m_callMethodFactory.RevokeAll();
+ m_taskList.revokeAll();
if (m_drtDevToolsAgent)
m_drtDevToolsAgent->detach();
}
void DRTDevToolsClient::reset()
{
- m_callMethodFactory.RevokeAll();
+ m_taskList.revokeAll();
}
void DRTDevToolsClient::sendFrontendLoaded() {
@@ -107,8 +106,7 @@ void DRTDevToolsClient::undockWindow()
void DRTDevToolsClient::asyncCall(const DRTDevToolsCallArgs& args)
{
- webkit_support::PostTaskFromHere(
- m_callMethodFactory.NewRunnableMethod(&DRTDevToolsClient::call, args));
+ postTask(new AsyncCallTask(this, args));
}
void DRTDevToolsClient::call(const DRTDevToolsCallArgs& args)
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
index 37b1e9d..f7c8fbf 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
@@ -31,7 +31,8 @@
#ifndef DRTDevToolsClient_h
#define DRTDevToolsClient_h
-#include "base/task.h" // FIXME: remove this
+#include "DRTDevToolsCallArgs.h"
+#include "Task.h"
#include "public/WebDevToolsFrontendClient.h"
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
@@ -45,7 +46,6 @@ class WebView;
} // namespace WebKit
-class DRTDevToolsCallArgs;
class DRTDevToolsAgent;
class DRTDevToolsClient : public WebKit::WebDevToolsFrontendClient
@@ -68,11 +68,20 @@ public:
void asyncCall(const DRTDevToolsCallArgs&);
void allMessagesProcessed();
+ TaskList* taskList() { return &m_taskList; }
private:
void call(const DRTDevToolsCallArgs&);
+ class AsyncCallTask: public MethodTask<DRTDevToolsClient> {
+ public:
+ AsyncCallTask(DRTDevToolsClient* object, const DRTDevToolsCallArgs& args)
+ : MethodTask<DRTDevToolsClient>(object), m_args(args) {}
+ virtual void runIfValid() { m_object->call(m_args); }
+ private:
+ DRTDevToolsCallArgs m_args;
+ };
- ScopedRunnableMethodFactory<DRTDevToolsClient> m_callMethodFactory;
+ TaskList m_taskList;
WebKit::WebView* m_webView;
DRTDevToolsAgent* m_drtDevToolsAgent;
WTF::OwnPtr<WebKit::WebDevToolsFrontend> m_webDevToolsFrontend;
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index 49421f6..243ec78 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -244,8 +244,7 @@ enum KeyLocationCode {
};
EventSender::EventSender(TestShell* shell)
- : m_methodFactory(this)
- , m_shell(shell)
+ : m_shell(shell)
{
// Initialize the map that associates methods of this class with the names
// they will use when called by JavaScript. The actual binding of those
@@ -322,7 +321,7 @@ void EventSender::reset()
timeOffsetMs = 0;
touchModifiers = 0;
touchPoints.clear();
- m_methodFactory.RevokeAll();
+ m_taskList.revokeAll();
}
WebView* EventSender::webview()
@@ -750,14 +749,29 @@ void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res
pressedButton = WebMouseEvent::ButtonNone;
}
+class MouseDownTask: public MethodTask<EventSender> {
+public:
+ MouseDownTask(EventSender* obj, const CppArgumentList& arg)
+ : MethodTask<EventSender>(obj), m_arguments(arg) {}
+ virtual void runIfValid() { m_object->mouseDown(m_arguments, 0); }
+private:
+ CppArgumentList m_arguments;
+};
+
+class MouseUpTask: public MethodTask<EventSender> {
+public:
+ MouseUpTask(EventSender* obj, const CppArgumentList& arg)
+ : MethodTask<EventSender>(obj), m_arguments(arg) {}
+ virtual void runIfValid() { m_object->mouseUp(m_arguments, 0); }
+private:
+ CppArgumentList m_arguments;
+};
+
void EventSender::scheduleAsynchronousClick(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
-
- webkit_support::PostTaskFromHere(m_methodFactory.NewRunnableMethod(
- &EventSender::mouseDown, arguments, static_cast<CppVariant*>(0)));
- webkit_support::PostTaskFromHere(m_methodFactory.NewRunnableMethod(
- &EventSender::mouseUp, arguments, static_cast<CppVariant*>(0)));
+ postTask(new MouseDownTask(this, arguments));
+ postTask(new MouseUpTask(this, arguments));
}
void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVariant* result)
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.h b/WebKitTools/DumpRenderTree/chromium/EventSender.h
index 0d8fe5d..399a132 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.h
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.h
@@ -38,7 +38,7 @@
#define EventSender_h
#include "CppBoundClass.h"
-#include "base/task.h"
+#include "Task.h"
#include "public/WebDragOperation.h"
#include "public/WebInputEvent.h"
#include "public/WebPoint.h"
@@ -108,6 +108,8 @@ public:
CppVariant wmSysDeadChar;
#endif
+ TaskList* taskList() { return &m_taskList; }
+
private:
// Returns the test shell's webview.
WebKit::WebView* webview();
@@ -141,7 +143,7 @@ private:
// Handle a request to send a wheel event.
void handleMouseWheel(const CppArgumentList&, CppVariant*, bool continuous);
- ScopedRunnableMethodFactory<EventSender> m_methodFactory;
+ TaskList m_taskList;
// Non-owning pointer. The EventSender is owned by the TestShell.
TestShell* m_shell;
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index 2999d3a..8e08c4c 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -67,8 +67,7 @@ using namespace WebKit;
using namespace std;
LayoutTestController::LayoutTestController(TestShell* shell)
- : m_timeoutFactory(this)
- , m_shell(shell)
+ : m_shell(shell)
, m_workQueue(this)
{
@@ -207,10 +206,9 @@ void LayoutTestController::WorkQueue::processWorkSoon()
if (!m_queue.isEmpty()) {
// We delay processing queued work to avoid recursion problems.
- m_timer.Start(base::TimeDelta(), this, &WorkQueue::processWork);
- } else if (!m_controller->m_waitUntilDone) {
+ postTask(new WorkQueueTask(this));
+ } else if (!m_controller->m_waitUntilDone)
m_controller->m_shell->testFinished();
- }
}
void LayoutTestController::WorkQueue::processWork()
@@ -320,11 +318,8 @@ void LayoutTestController::setAcceptsEditing(const CppArgumentList& arguments, C
void LayoutTestController::waitUntilDone(const CppArgumentList&, CppVariant* result)
{
- if (!webkit_support::BeingDebugged()) {
- webkit_support::PostDelayedTaskFromHere(
- m_timeoutFactory.NewRunnableMethod(&LayoutTestController::notifyDoneTimedOut),
- m_shell->layoutTestTimeout());
- }
+ if (!webkit_support::BeingDebugged())
+ postDelayedTask(new NotifyDoneTimedOutTask(this), m_shell->layoutTestTimeout());
m_waitUntilDone = true;
result->setNull();
}
@@ -332,17 +327,12 @@ void LayoutTestController::waitUntilDone(const CppArgumentList&, CppVariant* res
void LayoutTestController::notifyDone(const CppArgumentList&, CppVariant* result)
{
// Test didn't timeout. Kill the timeout timer.
- m_timeoutFactory.RevokeAll();
+ m_taskList.revokeAll();
completeNotifyDone(false);
result->setNull();
}
-void LayoutTestController::notifyDoneTimedOut()
-{
- completeNotifyDone(true);
-}
-
void LayoutTestController::completeNotifyDone(bool isTimeout)
{
if (m_waitUntilDone && !m_shell->webViewHost()->topLoadingFrame() && m_workQueue.isEmpty()) {
@@ -521,7 +511,7 @@ void LayoutTestController::reset()
else
m_closeRemainingWindows = true;
m_workQueue.reset();
- m_timeoutFactory.RevokeAll();
+ m_taskList.revokeAll();
}
void LayoutTestController::locationChangeDone()
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 6706157..55c8c8b 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -42,7 +42,7 @@
#define LayoutTestController_h
#include "CppBoundClass.h"
-#include "base/timer.h" // FIXME: Remove this.
+#include "Task.h"
#include "public/WebString.h"
#include "public/WebURL.h"
#include <wtf/Deque.h>
@@ -116,7 +116,6 @@ public:
// to delay the completion of the test until notifyDone is called.
void waitUntilDone(const CppArgumentList&, CppVariant*);
void notifyDone(const CppArgumentList&, CppVariant*);
- void notifyDoneTimedOut();
// Methods for adding actions to the work queue. Used in conjunction with
// waitUntilDone/notifyDone above.
@@ -360,6 +359,8 @@ public:
virtual bool run(TestShell* shell) = 0;
};
+ TaskList* taskList() { return &m_taskList; }
+
private:
friend class WorkItem;
friend class WorkQueue;
@@ -379,11 +380,17 @@ private:
void setFrozen(bool frozen) { m_frozen = frozen; }
bool isEmpty() { return m_queue.isEmpty(); }
+ TaskList* taskList() { return &m_taskList; }
private:
void processWork();
+ class WorkQueueTask: public MethodTask<WorkQueue> {
+ public:
+ WorkQueueTask(WorkQueue* object): MethodTask<WorkQueue>(object) {}
+ virtual void runIfValid() { m_object->processWork(); }
+ };
- base::OneShotTimer<WorkQueue> m_timer;
+ TaskList m_taskList;
Deque<WorkItem*> m_queue;
bool m_frozen;
LayoutTestController* m_controller;
@@ -396,6 +403,12 @@ private:
void logErrorToConsole(const std::string&);
void completeNotifyDone(bool isTimeout);
+ class NotifyDoneTimedOutTask: public MethodTask<LayoutTestController> {
+ public:
+ NotifyDoneTimedOutTask(LayoutTestController* object): MethodTask<LayoutTestController>(object) {}
+ virtual void runIfValid() { m_object->completeNotifyDone(true); }
+ };
+
bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
@@ -405,7 +418,7 @@ private:
void resumeAnimations();
// Used for test timeouts.
- ScopedRunnableMethodFactory<LayoutTestController> m_timeoutFactory;
+ TaskList m_taskList;
// Non-owning pointer. The LayoutTestController is owned by the host.
TestShell* m_shell;
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
index 1098e38..7d4cbe3 100644
--- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
@@ -31,14 +31,14 @@
#include "config.h"
#include "NotificationPresenter.h"
-#include "base/task.h" // FIXME: Remove this
#include "googleurl/src/gurl.h"
+#include "public/WebKit.h"
+#include "public/WebKitClient.h"
#include "public/WebNotification.h"
#include "public/WebNotificationPermissionCallback.h"
#include "public/WebSecurityOrigin.h"
#include "public/WebString.h"
#include "public/WebURL.h"
-#include "webkit/support/webkit_support.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -51,9 +51,11 @@ static WebString identifierForNotification(const WebNotification& notification)
return notification.title();
}
-static void deferredDisplayDispatch(WebNotification notification)
+static void deferredDisplayDispatch(void* context)
{
- notification.dispatchDisplayEvent();
+ WebNotification* notification = static_cast<WebNotification*>(context);
+ notification->dispatchDisplayEvent();
+ delete notification;
}
void NotificationPresenter::grantPermission(const WebString& origin)
@@ -105,8 +107,7 @@ bool NotificationPresenter::show(const WebNotification& notification)
WTF::String id(identifier.data(), identifier.length());
m_activeNotifications.set(id, notification);
- WebNotification eventTarget(notification);
- webkit_support::PostTaskFromHere(NewRunnableFunction(&deferredDisplayDispatch, eventTarget));
+ webKitClient()->callOnMainThread(deferredDisplayDispatch, new WebNotification(notification));
return true;
}
diff --git a/WebKitTools/DumpRenderTree/chromium/Task.cpp b/WebKitTools/DumpRenderTree/chromium/Task.cpp
new file mode 100644
index 0000000..3f90d8c
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/Task.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Task.h"
+
+#include "public/WebKit.h"
+#include "public/WebKitClient.h"
+#include "webkit/support/webkit_support.h"
+
+WebTask::WebTask(TaskList* list): m_taskList(list) { m_taskList->registerTask(this); }
+WebTask::~WebTask() { m_taskList->unregisterTask(this); }
+
+void TaskList::unregisterTask(WebTask* task)
+{
+ size_t index = m_tasks.find(task);
+ if (index != notFound)
+ m_tasks.remove(index);
+}
+
+void TaskList::revokeAll()
+{
+ for (unsigned i = 0; i < m_tasks.size(); ++i)
+ m_tasks[i]->cancel();
+ m_tasks.clear();
+}
+
+static void invokeTask(void* context)
+{
+ WebTask* task = static_cast<WebTask*>(context);
+ task->run();
+ delete task;
+}
+
+void postTask(WebTask* task)
+{
+ WebKit::webKitClient()->callOnMainThread(invokeTask, static_cast<void*>(task));
+}
+
+void postDelayedTask(WebTask* task, int64_t ms)
+{
+ webkit_support::PostDelayedTask(invokeTask, static_cast<void*>(task), ms);
+}
+
+
diff --git a/WebKitTools/DumpRenderTree/chromium/Task.h b/WebKitTools/DumpRenderTree/chromium/Task.h
new file mode 100644
index 0000000..39fb8f2
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/Task.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Task_h
+#define Task_h
+
+#include <wtf/Vector.h>
+
+class TaskList;
+
+// WebTask represents a task which can run by postTask() or postDelayedTask().
+// it is named "WebTask", not "Task", to avoid conflist with base/task.h.
+class WebTask {
+public:
+ WebTask(TaskList*);
+ // The main code of this task.
+ // An implementation of run() should return immediately if cancel() was called.
+ virtual void run() = 0;
+ virtual void cancel() = 0;
+ virtual ~WebTask();
+private:
+ TaskList* m_taskList;
+};
+
+class TaskList {
+public:
+ TaskList() {}
+ ~TaskList() { revokeAll(); }
+ void registerTask(WebTask* task) { m_tasks.append(task); }
+ void unregisterTask(WebTask* task);
+ void revokeAll();
+private:
+ Vector<WebTask*> m_tasks;
+};
+
+// A task containing an object pointer of class T. Is is supposed that
+// runifValid() calls a member function of the object pointer.
+// Class T must have "TaskList* taskList()".
+template<class T> class MethodTask: public WebTask {
+public:
+ MethodTask(T* object): WebTask(object->taskList()), m_object(object) {}
+ virtual void run()
+ {
+ if (m_object)
+ runIfValid();
+ }
+ virtual void cancel() { m_object = 0; }
+ virtual void runIfValid() = 0;
+protected:
+ T* m_object;
+};
+
+void postTask(WebTask* task);
+void postDelayedTask(WebTask* task, int64_t ms);
+
+#endif // Task_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list