[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
dimich at chromium.org
dimich at chromium.org
Thu Dec 3 13:35:12 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 764390ea6421b96833e01d9eadc7ac9f33c326ab
Author: dimich at chromium.org <dimich at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 13 01:12:20 2009 +0000
Add postTaskToMainThread to ScriptExecutionContext.
Move the code to post task to the main thread into a new method on ScriptExecutionContext,
to use as a helper implementation of the virtual ScriptExecutionContext::postTask(Task) in
contexts that live on the main thread.
https://bugs.webkit.org/show_bug.cgi?id=31427
Reviewed by Alexey Proskuryakov.
No new tests - simply moving the code.
* dom/Document.cpp:
(WebCore::Document::postTask):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
(WebCore::ScriptExecutionContextTaskTimer::fired):
(WebCore::PerformTaskData::PerformTaskData):
(WebCore::PerformTaskData::performTask):
(WebCore::ScriptExecutionContext::postTaskToMainThread):
* dom/ScriptExecutionContext.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 54aa7f7..cfdc4af 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-11-12 Dmitry Titov <dimich at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add postTaskToMainThread to ScriptExecutionContext.
+ Move the code to post task to the main thread into a new method on ScriptExecutionContext,
+ to use as a helper implementation of the virtual ScriptExecutionContext::postTask(Task) in
+ contexts that live on the main thread.
+ https://bugs.webkit.org/show_bug.cgi?id=31427
+
+ No new tests - simply moving the code.
+
+ * dom/Document.cpp:
+ (WebCore::Document::postTask):
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
+ (WebCore::ScriptExecutionContextTaskTimer::fired):
+ (WebCore::PerformTaskData::PerformTaskData):
+ (WebCore::PerformTaskData::performTask):
+ (WebCore::ScriptExecutionContext::postTaskToMainThread):
+ * dom/ScriptExecutionContext.h:
+
2009-11-12 Simon Fraser <simon.fraser at apple.com>
Reviewed by Darin Adler.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index dec15bf..913f570 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4536,51 +4536,9 @@ void Document::scriptImported(unsigned long identifier, const String& sourceStri
#endif
}
-class ScriptExecutionContextTaskTimer : public TimerBase {
-public:
- ScriptExecutionContextTaskTimer(PassRefPtr<Document> context, PassOwnPtr<ScriptExecutionContext::Task> task)
- : m_context(context)
- , m_task(task)
- {
- }
-
-private:
- virtual void fired()
- {
- m_task->performTask(m_context.get());
- delete this;
- }
-
- RefPtr<Document> m_context;
- OwnPtr<ScriptExecutionContext::Task> m_task;
-};
-
-struct PerformTaskContext : Noncopyable {
- PerformTaskContext(ScriptExecutionContext* scriptExecutionContext, PassOwnPtr<ScriptExecutionContext::Task> task)
- : scriptExecutionContext(scriptExecutionContext)
- , task(task)
- {
- }
-
- ScriptExecutionContext* scriptExecutionContext; // The context should exist until task execution.
- OwnPtr<ScriptExecutionContext::Task> task;
-};
-
-static void performTask(void* ctx)
-{
- PerformTaskContext* ptctx = reinterpret_cast<PerformTaskContext*>(ctx);
- ptctx->task->performTask(ptctx->scriptExecutionContext);
- delete ptctx;
-}
-
void Document::postTask(PassOwnPtr<Task> task)
{
- if (isMainThread()) {
- ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(static_cast<Document*>(this), task);
- timer->startOneShot(0);
- } else {
- callOnMainThread(performTask, new PerformTaskContext(this, task));
- }
+ postTaskToMainThread(task);
}
Element* Document::findAnchor(const String& name)
diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp
index bc71084..c8d1b36 100644
--- a/WebCore/dom/ScriptExecutionContext.cpp
+++ b/WebCore/dom/ScriptExecutionContext.cpp
@@ -215,4 +215,53 @@ JSC::JSGlobalData* ScriptExecutionContext::globalData()
}
#endif
+class ScriptExecutionContextTaskTimer : public TimerBase {
+public:
+ ScriptExecutionContextTaskTimer(PassRefPtr<ScriptExecutionContext> context, PassOwnPtr<ScriptExecutionContext::Task> task)
+ : m_context(context)
+ , m_task(task)
+ {
+ }
+
+private:
+ virtual void fired()
+ {
+ m_task->performTask(m_context.get());
+ delete this;
+ }
+
+ RefPtr<ScriptExecutionContext> m_context;
+ OwnPtr<ScriptExecutionContext::Task> m_task;
+};
+
+class PerformTaskData {
+public:
+ PerformTaskData(PassRefPtr<ScriptExecutionContext> context, PassOwnPtr<ScriptExecutionContext::Task> task)
+ : m_context(context)
+ , m_task(task)
+ {
+ }
+
+ static void performTask(void* data)
+ {
+ PerformTaskData* taskData = static_cast<PerformTaskData*>(data);
+ taskData->m_task->performTask(taskData->m_context.get());
+ delete taskData;
+ }
+
+private:
+ RefPtr<ScriptExecutionContext> m_context;
+ OwnPtr<ScriptExecutionContext::Task> m_task;
+};
+
+void ScriptExecutionContext::postTaskToMainThread(PassOwnPtr<Task> task)
+{
+ if (isMainThread()) {
+ ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(this, task);
+ timer->startOneShot(0);
+ } else {
+ callOnMainThread(PerformTaskData::performTask, new PerformTaskData(this, task));
+ }
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h
index 1414125..0e5521b 100644
--- a/WebCore/dom/ScriptExecutionContext.h
+++ b/WebCore/dom/ScriptExecutionContext.h
@@ -114,6 +114,9 @@ namespace WebCore {
// that already contains content.
void setSecurityOrigin(PassRefPtr<SecurityOrigin>);
+ // Helper for contexts that live on the main thread.
+ void postTaskToMainThread(PassOwnPtr<Task>);
+
private:
virtual const KURL& virtualURL() const = 0;
virtual KURL virtualCompleteURL(const String&) const = 0;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list