<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[50427] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/50427">50427</a></dd>
<dt>Author</dt> <dd>dimich@chromium.org</dd>
<dt>Date</dt> <dd>2009-11-02 13:31:22 -0800 (Mon, 02 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove threadsafe refcounting from tasks used with WTF::MessageQueue.
https://bugs.webkit.org/show_bug.cgi?id=30612

Reviewed by David Levin.

JavaScriptCore:

* wtf/MessageQueue.h:
(WTF::MessageQueue::alwaysTruePredicate):
(WTF::MessageQueue::~MessageQueue):
(WTF::MessageQueue::append):
(WTF::MessageQueue::appendAndCheckEmpty):
(WTF::MessageQueue::prepend):
(WTF::MessageQueue::waitForMessage):
(WTF::MessageQueue::waitForMessageFilteredWithTimeout):
(WTF::MessageQueue::tryGetMessage):
(WTF::MessageQueue::removeIf):
The MessageQueue is changed to act as a queue of OwnPtr&lt;DataType&gt;. It takes ownership
of posted tasks and passes it to the new owner (in another thread) when the task is fetched.
All methods have arguments of type PassOwnPtr&lt;DataType&gt; and return the same type.

* wtf/Threading.cpp:
(WTF::createThread):
Superficial change to trigger rebuild of JSC project on Windows,
workaround for https://bugs.webkit.org/show_bug.cgi?id=30890

WebCore:

No new tests since no new functionality. Storage, MessagePorts and Workers tests cover this.

There are a lot of files but most changes are simply replace RefPtr and PassRefPtr with
OwnPtr and PassOwnPtr when dealing with Tasks.

ScriptExecutionContext::Task, DatabaseTask and WorkerRunLoop::Task are no longer
threadsafe refcounted, but simply Noncopyable.

* dom/Document.cpp:
(WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
(WebCore::PerformTaskContext::PerformTaskContext):
(WebCore::Document::postTask):
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ProcessMessagesSoonTask::create):
* dom/ScriptExecutionContext.h:
* dom/default/PlatformMessagePortChannel.cpp:
(WebCore::PlatformMessagePortChannel::tryGetMessageFromRemote):
* dom/default/PlatformMessagePortChannel.h:
(WebCore::PlatformMessagePortChannel::MessagePortQueue::tryGetMessage):
(WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
* loader/FrameLoader.cpp:
(WebCore::HashChangeEventTask::create):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::CallCacheListenerTask::create):
* storage/Database.cpp:
(WebCore::Database::openAndVerifyVersion):
(WebCore::Database::markAsDeletedAndClose):
(WebCore::Database::scheduleTransaction):
(WebCore::Database::scheduleTransactionStep):
(WebCore::Database::tableNames):
* storage/DatabaseTask.h:
(WebCore::DatabaseOpenTask::create):
(WebCore::DatabaseCloseTask::create):
(WebCore::DatabaseTransactionTask::create):
(WebCore::DatabaseTableNamesTask::create):
* storage/DatabaseThread.cpp:
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::scheduleTask):
(WebCore::DatabaseThread::scheduleImmediateTask):
(WebCore::SameDatabasePredicate::operator()):
* storage/DatabaseThread.h:
* storage/LocalStorageTask.h:
(WebCore::LocalStorageTask::createImport):
(WebCore::LocalStorageTask::createSync):
(WebCore::LocalStorageTask::createTerminate):
* storage/LocalStorageThread.cpp:
(WebCore::LocalStorageThread::localStorageThread):
* storage/LocalStorageThread.h:
* websockets/WebSocket.cpp:
(WebCore::ProcessWebSocketEventTask::create):
* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerProxy::postTaskToLoader):
(WebCore::SharedWorkerProxy::postTaskForModeToWorkerContext):
(WebCore::SharedWorkerConnectTask::create):
* workers/GenericWorkerTask.h:
(WebCore::GenericWorkerTask1::create):
(WebCore::GenericWorkerTask2::create):
(WebCore::GenericWorkerTask3::create):
(WebCore::GenericWorkerTask4::create):
(WebCore::GenericWorkerTask5::create):
(WebCore::GenericWorkerTask6::create):
(WebCore::GenericWorkerTask7::create):
(WebCore::GenericWorkerTask8::create):
(WebCore::createCallbackTask):
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::postTask):
* workers/WorkerContext.h:
* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::MessageWorkerContextTask::create):
(WebCore::MessageWorkerTask::create):
(WebCore::WorkerExceptionTask::create):
(WebCore::WorkerContextDestroyedTask::create):
(WebCore::WorkerTerminateTask::create):
(WebCore::WorkerThreadActivityReportTask::create):
(WebCore::WorkerMessagingProxy::postTaskForModeToWorkerContext):
(WebCore::WorkerMessagingProxy::postTaskToLoader):
(WebCore::WorkerMessagingProxy::workerThreadCreated):
* workers/WorkerMessagingProxy.h:
* workers/WorkerRunLoop.cpp:
(WebCore::ModePredicate::operator()):
(WebCore::WorkerRunLoop::runInMode):
(WebCore::WorkerRunLoop::postTask):
(WebCore::WorkerRunLoop::postTaskForMode):
(WebCore::WorkerRunLoop::Task::create):
(WebCore::WorkerRunLoop::Task::performTask):
(WebCore::WorkerRunLoop::Task::Task):
* workers/WorkerRunLoop.h:
(WebCore::WorkerRunLoop::Task::~Task):
(WebCore::WorkerRunLoop::Task::mode):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCorewtfMessageQueueh">trunk/JavaScriptCore/wtf/MessageQueue.h</a></li>
<li><a href="#trunkJavaScriptCorewtfThreadingcpp">trunk/JavaScriptCore/wtf/Threading.cpp</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoredomDocumentcpp">trunk/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkWebCoredomDocumenth">trunk/WebCore/dom/Document.h</a></li>
<li><a href="#trunkWebCoredomScriptExecutionContextcpp">trunk/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkWebCoredomScriptExecutionContexth">trunk/WebCore/dom/ScriptExecutionContext.h</a></li>
<li><a href="#trunkWebCoredomdefaultPlatformMessagePortChannelcpp">trunk/WebCore/dom/default/PlatformMessagePortChannel.cpp</a></li>
<li><a href="#trunkWebCoredomdefaultPlatformMessagePortChannelh">trunk/WebCore/dom/default/PlatformMessagePortChannel.h</a></li>
<li><a href="#trunkWebCoreloaderFrameLoadercpp">trunk/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkWebCorestorageDatabasecpp">trunk/WebCore/storage/Database.cpp</a></li>
<li><a href="#trunkWebCorestorageDatabaseTaskh">trunk/WebCore/storage/DatabaseTask.h</a></li>
<li><a href="#trunkWebCorestorageDatabaseThreadcpp">trunk/WebCore/storage/DatabaseThread.cpp</a></li>
<li><a href="#trunkWebCorestorageDatabaseThreadh">trunk/WebCore/storage/DatabaseThread.h</a></li>
<li><a href="#trunkWebCorestorageLocalStorageTaskh">trunk/WebCore/storage/LocalStorageTask.h</a></li>
<li><a href="#trunkWebCorestorageLocalStorageThreadcpp">trunk/WebCore/storage/LocalStorageThread.cpp</a></li>
<li><a href="#trunkWebCorestorageLocalStorageThreadh">trunk/WebCore/storage/LocalStorageThread.h</a></li>
<li><a href="#trunkWebCorewebsocketsWebSocketcpp">trunk/WebCore/websockets/WebSocket.cpp</a></li>
<li><a href="#trunkWebCoreworkersDefaultSharedWorkerRepositorycpp">trunk/WebCore/workers/DefaultSharedWorkerRepository.cpp</a></li>
<li><a href="#trunkWebCoreworkersGenericWorkerTaskh">trunk/WebCore/workers/GenericWorkerTask.h</a></li>
<li><a href="#trunkWebCoreworkersWorkerContextcpp">trunk/WebCore/workers/WorkerContext.cpp</a></li>
<li><a href="#trunkWebCoreworkersWorkerContexth">trunk/WebCore/workers/WorkerContext.h</a></li>
<li><a href="#trunkWebCoreworkersWorkerLoaderProxyh">trunk/WebCore/workers/WorkerLoaderProxy.h</a></li>
<li><a href="#trunkWebCoreworkersWorkerMessagingProxycpp">trunk/WebCore/workers/WorkerMessagingProxy.cpp</a></li>
<li><a href="#trunkWebCoreworkersWorkerMessagingProxyh">trunk/WebCore/workers/WorkerMessagingProxy.h</a></li>
<li><a href="#trunkWebCoreworkersWorkerRunLoopcpp">trunk/WebCore/workers/WorkerRunLoop.cpp</a></li>
<li><a href="#trunkWebCoreworkersWorkerRunLooph">trunk/WebCore/workers/WorkerRunLoop.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/JavaScriptCore/ChangeLog        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2009-11-02  Dmitry Titov  &lt;dimich@chromium.org&gt;
+
+        Reviewed by David Levin.
+
+        Remove threadsafe refcounting from tasks used with WTF::MessageQueue.
+        https://bugs.webkit.org/show_bug.cgi?id=30612
+
+        * wtf/MessageQueue.h:
+        (WTF::MessageQueue::alwaysTruePredicate):
+        (WTF::MessageQueue::~MessageQueue):
+        (WTF::MessageQueue::append):
+        (WTF::MessageQueue::appendAndCheckEmpty):
+        (WTF::MessageQueue::prepend):
+        (WTF::MessageQueue::waitForMessage):
+        (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
+        (WTF::MessageQueue::tryGetMessage):
+        (WTF::MessageQueue::removeIf):
+        The MessageQueue is changed to act as a queue of OwnPtr&lt;DataType&gt;. It takes ownership
+        of posted tasks and passes it to the new owner (in another thread) when the task is fetched.
+        All methods have arguments of type PassOwnPtr&lt;DataType&gt; and return the same type.
+
+        * wtf/Threading.cpp:
+        (WTF::createThread):
+        Superficial change to trigger rebuild of JSC project on Windows,
+        workaround for https://bugs.webkit.org/show_bug.cgi?id=30890
+
</ins><span class="cx"> 2009-10-30  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver Hunt.
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfMessageQueueh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/MessageQueue.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/MessageQueue.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/JavaScriptCore/wtf/MessageQueue.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -44,23 +44,27 @@
</span><span class="cx">         MessageQueueMessageReceived,  // A message was successfully received and returned.
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    // The queue takes ownership of messages and transfer it to the new owner
+    // when messages are fetched from the queue.
+    // Essentially, MessageQueue acts as a queue of OwnPtr&lt;DataType&gt;.
</ins><span class="cx">     template&lt;typename DataType&gt;
</span><span class="cx">     class MessageQueue : public Noncopyable {
</span><span class="cx">     public:
</span><span class="cx">         MessageQueue() : m_killed(false) { }
</span><del>-        
-        void append(const DataType&amp;);
-        bool appendAndCheckEmpty(const DataType&amp;);
-        void prepend(const DataType&amp;);
-        bool waitForMessage(DataType&amp;);
</del><ins>+        ~MessageQueue();
+
+        void append(PassOwnPtr&lt;DataType&gt;);
+        bool appendAndCheckEmpty(PassOwnPtr&lt;DataType&gt;);
+        void prepend(PassOwnPtr&lt;DataType&gt;);
+
+        PassOwnPtr&lt;DataType&gt; waitForMessage();
+        PassOwnPtr&lt;DataType&gt; tryGetMessage();
</ins><span class="cx">         template&lt;typename Predicate&gt;
</span><del>-        MessageQueueWaitResult waitForMessageFilteredWithTimeout(DataType&amp;, Predicate&amp;, double absoluteTime);
</del><ins>+        PassOwnPtr&lt;DataType&gt; waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp;, Predicate&amp;, double absoluteTime);
</ins><span class="cx"> 
</span><span class="cx">         template&lt;typename Predicate&gt;
</span><span class="cx">         void removeIf(Predicate&amp;);
</span><span class="cx"> 
</span><del>-        bool tryGetMessage(DataType&amp;);
-
</del><span class="cx">         void kill();
</span><span class="cx">         bool killed() const;
</span><span class="cx"> 
</span><span class="lines">@@ -70,86 +74,98 @@
</span><span class="cx">         static double infiniteTime() { return std::numeric_limits&lt;double&gt;::max(); }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        static bool alwaysTruePredicate(DataType&amp;) { return true; }
</del><ins>+        static bool alwaysTruePredicate(DataType*) { return true; }
</ins><span class="cx"> 
</span><span class="cx">         mutable Mutex m_mutex;
</span><span class="cx">         ThreadCondition m_condition;
</span><del>-        Deque&lt;DataType&gt; m_queue;
</del><ins>+        Deque&lt;DataType*&gt; m_queue;
</ins><span class="cx">         bool m_killed;
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><del>-    inline void MessageQueue&lt;DataType&gt;::append(const DataType&amp; message)
</del><ins>+    MessageQueue&lt;DataType&gt;::~MessageQueue()
</ins><span class="cx">     {
</span><ins>+        deleteAllValues(m_queue);
+    }
+
+    template&lt;typename DataType&gt;
+    inline void MessageQueue&lt;DataType&gt;::append(PassOwnPtr&lt;DataType&gt; message)
+    {
</ins><span class="cx">         MutexLocker lock(m_mutex);
</span><del>-        m_queue.append(message);
</del><ins>+        m_queue.append(message.release());
</ins><span class="cx">         m_condition.signal();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Returns true if the queue was empty before the item was added.
</span><span class="cx">     template&lt;typename DataType&gt;
</span><del>-    inline bool MessageQueue&lt;DataType&gt;::appendAndCheckEmpty(const DataType&amp; message)
</del><ins>+    inline bool MessageQueue&lt;DataType&gt;::appendAndCheckEmpty(PassOwnPtr&lt;DataType&gt; message)
</ins><span class="cx">     {
</span><span class="cx">         MutexLocker lock(m_mutex);
</span><span class="cx">         bool wasEmpty = m_queue.isEmpty();
</span><del>-        m_queue.append(message);
</del><ins>+        m_queue.append(message.release());
</ins><span class="cx">         m_condition.signal();
</span><span class="cx">         return wasEmpty;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><del>-    inline void MessageQueue&lt;DataType&gt;::prepend(const DataType&amp; message)
</del><ins>+    inline void MessageQueue&lt;DataType&gt;::prepend(PassOwnPtr&lt;DataType&gt; message)
</ins><span class="cx">     {
</span><span class="cx">         MutexLocker lock(m_mutex);
</span><del>-        m_queue.prepend(message);
</del><ins>+        m_queue.prepend(message.release());
</ins><span class="cx">         m_condition.signal();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><del>-    inline bool MessageQueue&lt;DataType&gt;::waitForMessage(DataType&amp; result)
</del><ins>+    inline PassOwnPtr&lt;DataType&gt; MessageQueue&lt;DataType&gt;::waitForMessage()
</ins><span class="cx">     {
</span><del>-        MessageQueueWaitResult exitReason = waitForMessageFilteredWithTimeout(result, MessageQueue&lt;DataType&gt;::alwaysTruePredicate, infiniteTime());
</del><ins>+        MessageQueueWaitResult exitReason; 
+        PassOwnPtr&lt;DataType&gt; result = waitForMessageFilteredWithTimeout(exitReason, MessageQueue&lt;DataType&gt;::alwaysTruePredicate, infiniteTime());
</ins><span class="cx">         ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived);
</span><del>-        return exitReason == MessageQueueMessageReceived;
</del><ins>+        return result;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><span class="cx">     template&lt;typename Predicate&gt;
</span><del>-    inline MessageQueueWaitResult MessageQueue&lt;DataType&gt;::waitForMessageFilteredWithTimeout(DataType&amp; result, Predicate&amp; predicate, double absoluteTime)
</del><ins>+    inline PassOwnPtr&lt;DataType&gt; MessageQueue&lt;DataType&gt;::waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp; result, Predicate&amp; predicate, double absoluteTime)
</ins><span class="cx">     {
</span><span class="cx">         MutexLocker lock(m_mutex);
</span><span class="cx">         bool timedOut = false;
</span><span class="cx"> 
</span><del>-        DequeConstIterator&lt;DataType&gt; found = m_queue.end();
</del><ins>+        DequeConstIterator&lt;DataType*&gt; found = m_queue.end();
</ins><span class="cx">         while (!m_killed &amp;&amp; !timedOut &amp;&amp; (found = m_queue.findIf(predicate)) == m_queue.end())
</span><span class="cx">             timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
</span><span class="cx"> 
</span><span class="cx">         ASSERT(!timedOut || absoluteTime != infiniteTime());
</span><span class="cx"> 
</span><del>-        if (m_killed)
-            return MessageQueueTerminated;
</del><ins>+        if (m_killed) {
+            result = MessageQueueTerminated;
+            return 0;
+        }
</ins><span class="cx"> 
</span><del>-        if (timedOut)
-            return MessageQueueTimeout;
</del><ins>+        if (timedOut) {
+            result = MessageQueueTimeout;
+            return 0;
+        }
</ins><span class="cx"> 
</span><span class="cx">         ASSERT(found != m_queue.end());
</span><del>-        result = *found;
</del><ins>+        DataType* message = *found;
</ins><span class="cx">         m_queue.remove(found);
</span><del>-        return MessageQueueMessageReceived;
</del><ins>+        result = MessageQueueMessageReceived;
+        return message;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><del>-    inline bool MessageQueue&lt;DataType&gt;::tryGetMessage(DataType&amp; result)
</del><ins>+    inline PassOwnPtr&lt;DataType&gt; MessageQueue&lt;DataType&gt;::tryGetMessage()
</ins><span class="cx">     {
</span><span class="cx">         MutexLocker lock(m_mutex);
</span><span class="cx">         if (m_killed)
</span><del>-            return false;
</del><ins>+            return 0;
</ins><span class="cx">         if (m_queue.isEmpty())
</span><del>-            return false;
</del><ins>+            return 0;
</ins><span class="cx"> 
</span><del>-        result = m_queue.first();
</del><ins>+        DataType* message = m_queue.first();
</ins><span class="cx">         m_queue.removeFirst();
</span><del>-        return true;
</del><ins>+        return message;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><span class="lines">@@ -157,9 +173,11 @@
</span><span class="cx">     inline void MessageQueue&lt;DataType&gt;::removeIf(Predicate&amp; predicate)
</span><span class="cx">     {
</span><span class="cx">         MutexLocker lock(m_mutex);
</span><del>-        DequeConstIterator&lt;DataType&gt; found = m_queue.end();
</del><ins>+        DequeConstIterator&lt;DataType*&gt; found = m_queue.end();
</ins><span class="cx">         while ((found = m_queue.findIf(predicate)) != m_queue.end()) {
</span><ins>+            DataType* message = *found;
</ins><span class="cx">             m_queue.remove(found);
</span><ins>+            delete message;
</ins><span class="cx">        }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfThreadingcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/Threading.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/Threading.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/JavaScriptCore/wtf/Threading.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">     NewThreadContext* context = new NewThreadContext(entryPoint, data, name);
</span><span class="cx"> 
</span><del>-    // Prevent the thread body from executing until we've established the thread identifier
</del><ins>+    // Prevent the thread body from executing until we've established the thread identifier.
</ins><span class="cx">     MutexLocker locker(context-&gt;creationMutex);
</span><span class="cx"> 
</span><span class="cx">     return createThreadInternal(threadEntryPoint, context, name);
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/ChangeLog        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -1,3 +1,102 @@
</span><ins>+2009-11-02  Dmitry Titov  &lt;dimich@chromium.org&gt;
+
+        Reviewed by David Levin.
+
+        Remove threadsafe refcounting from tasks used with WTF::MessageQueue.
+        https://bugs.webkit.org/show_bug.cgi?id=30612
+
+        No new tests since no new functionality. Storage, MessagePorts and Workers tests cover this.
+
+        There are a lot of files but most changes are simply replace RefPtr and PassRefPtr with
+        OwnPtr and PassOwnPtr when dealing with Tasks.
+
+        ScriptExecutionContext::Task, DatabaseTask and WorkerRunLoop::Task are no longer
+        threadsafe refcounted, but simply Noncopyable.
+
+        * dom/Document.cpp:
+        (WebCore::ScriptExecutionContextTaskTimer::ScriptExecutionContextTaskTimer):
+        (WebCore::PerformTaskContext::PerformTaskContext):
+        (WebCore::Document::postTask):
+        * dom/Document.h:
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ProcessMessagesSoonTask::create):
+        * dom/ScriptExecutionContext.h:
+        * dom/default/PlatformMessagePortChannel.cpp:
+        (WebCore::PlatformMessagePortChannel::tryGetMessageFromRemote):
+        * dom/default/PlatformMessagePortChannel.h:
+        (WebCore::PlatformMessagePortChannel::MessagePortQueue::tryGetMessage):
+        (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
+        * loader/FrameLoader.cpp:
+        (WebCore::HashChangeEventTask::create):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::CallCacheListenerTask::create):
+        * storage/Database.cpp:
+        (WebCore::Database::openAndVerifyVersion):
+        (WebCore::Database::markAsDeletedAndClose):
+        (WebCore::Database::scheduleTransaction):
+        (WebCore::Database::scheduleTransactionStep):
+        (WebCore::Database::tableNames):
+        * storage/DatabaseTask.h:
+        (WebCore::DatabaseOpenTask::create):
+        (WebCore::DatabaseCloseTask::create):
+        (WebCore::DatabaseTransactionTask::create):
+        (WebCore::DatabaseTableNamesTask::create):
+        * storage/DatabaseThread.cpp:
+        (WebCore::DatabaseThread::databaseThread):
+        (WebCore::DatabaseThread::scheduleTask):
+        (WebCore::DatabaseThread::scheduleImmediateTask):
+        (WebCore::SameDatabasePredicate::operator()):
+        * storage/DatabaseThread.h:
+        * storage/LocalStorageTask.h:
+        (WebCore::LocalStorageTask::createImport):
+        (WebCore::LocalStorageTask::createSync):
+        (WebCore::LocalStorageTask::createTerminate):
+        * storage/LocalStorageThread.cpp:
+        (WebCore::LocalStorageThread::localStorageThread):
+        * storage/LocalStorageThread.h:
+        * websockets/WebSocket.cpp:
+        (WebCore::ProcessWebSocketEventTask::create):
+        * workers/DefaultSharedWorkerRepository.cpp:
+        (WebCore::SharedWorkerProxy::postTaskToLoader):
+        (WebCore::SharedWorkerProxy::postTaskForModeToWorkerContext):
+        (WebCore::SharedWorkerConnectTask::create):
+        * workers/GenericWorkerTask.h:
+        (WebCore::GenericWorkerTask1::create):
+        (WebCore::GenericWorkerTask2::create):
+        (WebCore::GenericWorkerTask3::create):
+        (WebCore::GenericWorkerTask4::create):
+        (WebCore::GenericWorkerTask5::create):
+        (WebCore::GenericWorkerTask6::create):
+        (WebCore::GenericWorkerTask7::create):
+        (WebCore::GenericWorkerTask8::create):
+        (WebCore::createCallbackTask):
+        * workers/WorkerContext.cpp:
+        (WebCore::WorkerContext::postTask):
+        * workers/WorkerContext.h:
+        * workers/WorkerLoaderProxy.h:
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::MessageWorkerContextTask::create):
+        (WebCore::MessageWorkerTask::create):
+        (WebCore::WorkerExceptionTask::create):
+        (WebCore::WorkerContextDestroyedTask::create):
+        (WebCore::WorkerTerminateTask::create):
+        (WebCore::WorkerThreadActivityReportTask::create):
+        (WebCore::WorkerMessagingProxy::postTaskForModeToWorkerContext):
+        (WebCore::WorkerMessagingProxy::postTaskToLoader):
+        (WebCore::WorkerMessagingProxy::workerThreadCreated):
+        * workers/WorkerMessagingProxy.h:
+        * workers/WorkerRunLoop.cpp:
+        (WebCore::ModePredicate::operator()):
+        (WebCore::WorkerRunLoop::runInMode):
+        (WebCore::WorkerRunLoop::postTask):
+        (WebCore::WorkerRunLoop::postTaskForMode):
+        (WebCore::WorkerRunLoop::Task::create):
+        (WebCore::WorkerRunLoop::Task::performTask):
+        (WebCore::WorkerRunLoop::Task::Task):
+        * workers/WorkerRunLoop.h:
+        (WebCore::WorkerRunLoop::Task::~Task):
+        (WebCore::WorkerRunLoop::Task::mode):
+
</ins><span class="cx"> 2009-11-02  Philippe Normand  &lt;pnormand@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Jan Alonzo.
</span></span></pre></div>
<a id="trunkWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Document.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Document.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/Document.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -4537,7 +4537,7 @@
</span><span class="cx"> 
</span><span class="cx"> class ScriptExecutionContextTaskTimer : public TimerBase {
</span><span class="cx"> public:
</span><del>-    ScriptExecutionContextTaskTimer(PassRefPtr&lt;Document&gt; context, PassRefPtr&lt;ScriptExecutionContext::Task&gt; task)
</del><ins>+    ScriptExecutionContextTaskTimer(PassRefPtr&lt;Document&gt; context, PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task)
</ins><span class="cx">         : m_context(context)
</span><span class="cx">         , m_task(task)
</span><span class="cx">     {
</span><span class="lines">@@ -4551,18 +4551,18 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Document&gt; m_context;
</span><del>-    RefPtr&lt;ScriptExecutionContext::Task&gt; m_task;
</del><ins>+    OwnPtr&lt;ScriptExecutionContext::Task&gt; m_task;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct PerformTaskContext {
</span><del>-    PerformTaskContext(ScriptExecutionContext* scriptExecutionContext, PassRefPtr&lt;ScriptExecutionContext::Task&gt; task)
</del><ins>+    PerformTaskContext(ScriptExecutionContext* scriptExecutionContext, PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task)
</ins><span class="cx">         : scriptExecutionContext(scriptExecutionContext)
</span><span class="cx">         , task(task)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ScriptExecutionContext* scriptExecutionContext; // The context should exist until task execution.
</span><del>-    RefPtr&lt;ScriptExecutionContext::Task&gt; task;
</del><ins>+    OwnPtr&lt;ScriptExecutionContext::Task&gt; task;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static void performTask(void* ctx)
</span><span class="lines">@@ -4572,7 +4572,7 @@
</span><span class="cx">     delete ptctx;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::postTask(PassRefPtr&lt;Task&gt; task)
</del><ins>+void Document::postTask(PassOwnPtr&lt;Task&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     if (isMainThread()) {
</span><span class="cx">         ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(static_cast&lt;Document*&gt;(this), task);
</span></span></pre></div>
<a id="trunkWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Document.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Document.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/Document.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -819,7 +819,7 @@
</span><span class="cx">     virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String&amp; message, unsigned lineNumber, const String&amp; sourceURL);
</span><span class="cx">     virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString&amp; sourceString);
</span><span class="cx">     virtual void scriptImported(unsigned long, const String&amp;);
</span><del>-    virtual void postTask(PassRefPtr&lt;Task&gt;); // Executes the task on context's thread asynchronously.
</del><ins>+    virtual void postTask(PassOwnPtr&lt;Task&gt;); // Executes the task on context's thread asynchronously.
</ins><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;WebCore::Node*, JSNode*&gt; JSWrapperCache;
</span><span class="cx">     typedef HashMap&lt;DOMWrapperWorld*, JSWrapperCache*&gt; JSWrapperCacheMap;
</span></span></pre></div>
<a id="trunkWebCoredomScriptExecutionContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/ScriptExecutionContext.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ScriptExecutionContext.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/ScriptExecutionContext.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> 
</span><span class="cx"> class ProcessMessagesSoonTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;ProcessMessagesSoonTask&gt; create()
</del><ins>+    static PassOwnPtr&lt;ProcessMessagesSoonTask&gt; create()
</ins><span class="cx">     {
</span><del>-        return adoptRef(new ProcessMessagesSoonTask);
</del><ins>+        return new ProcessMessagesSoonTask;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual void performTask(ScriptExecutionContext* context)
</span></span></pre></div>
<a id="trunkWebCoredomScriptExecutionContexth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/ScriptExecutionContext.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ScriptExecutionContext.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/ScriptExecutionContext.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -92,13 +92,13 @@
</span><span class="cx">         void ref() { refScriptExecutionContext(); }
</span><span class="cx">         void deref() { derefScriptExecutionContext(); }
</span><span class="cx"> 
</span><del>-        class Task : public ThreadSafeShared&lt;Task&gt; {
</del><ins>+        class Task : public Noncopyable {
</ins><span class="cx">         public:
</span><span class="cx">             virtual ~Task();
</span><span class="cx">             virtual void performTask(ScriptExecutionContext*) = 0;
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-        virtual void postTask(PassRefPtr&lt;Task&gt;) = 0; // Executes the task on context's thread asynchronously.
</del><ins>+        virtual void postTask(PassOwnPtr&lt;Task&gt;) = 0; // Executes the task on context's thread asynchronously.
</ins><span class="cx"> 
</span><span class="cx">         void addTimeout(int timeoutId, DOMTimer*);
</span><span class="cx">         void removeTimeout(int timeoutId);
</span></span></pre></div>
<a id="trunkWebCoredomdefaultPlatformMessagePortChannelcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/default/PlatformMessagePortChannel.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/default/PlatformMessagePortChannel.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/default/PlatformMessagePortChannel.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -193,7 +193,8 @@
</span><span class="cx"> bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr&lt;MessagePortChannel::EventData&gt;&amp; result)
</span><span class="cx"> {
</span><span class="cx">     MutexLocker lock(m_mutex);
</span><del>-    return m_incomingQueue-&gt;tryGetMessage(result);
</del><ins>+    result = m_incomingQueue-&gt;tryGetMessage();
+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PlatformMessagePortChannel::isConnectedTo(MessagePort* port)
</span></span></pre></div>
<a id="trunkWebCoredomdefaultPlatformMessagePortChannelh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/default/PlatformMessagePortChannel.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/default/PlatformMessagePortChannel.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/dom/default/PlatformMessagePortChannel.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -63,18 +63,14 @@
</span><span class="cx">         public:
</span><span class="cx">             static PassRefPtr&lt;MessagePortQueue&gt; create() { return adoptRef(new MessagePortQueue()); }
</span><span class="cx"> 
</span><del>-            bool tryGetMessage(OwnPtr&lt;MessagePortChannel::EventData&gt;&amp; message)
</del><ins>+            PassOwnPtr&lt;MessagePortChannel::EventData&gt; tryGetMessage()
</ins><span class="cx">             {
</span><del>-                MessagePortChannel::EventData* holder = 0;
-                bool messageAvailable = m_queue.tryGetMessage(holder);
-                if (messageAvailable)
-                    message.set(holder);
-                return messageAvailable;
</del><ins>+                return m_queue.tryGetMessage();
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             bool appendAndCheckEmpty(PassOwnPtr&lt;MessagePortChannel::EventData&gt; message)
</span><span class="cx">             {
</span><del>-                return m_queue.appendAndCheckEmpty(message.release());
</del><ins>+                return m_queue.appendAndCheckEmpty(message);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             bool isEmpty()
</span><span class="lines">@@ -82,19 +78,10 @@
</span><span class="cx">                 return m_queue.isEmpty();
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            ~MessagePortQueue()
-            {
-                // Manually free any items left in the queue, since we can't use OwnPtr internally.
-                MessagePortChannel::EventData* data = 0;
-                while (m_queue.tryGetMessage(data))
-                    delete data;
-            }
</del><span class="cx">         private:
</span><span class="cx">             MessagePortQueue() { }
</span><span class="cx"> 
</span><del>-            // OwnPtr is Noncopyable, so we can't use it as the template type in a MessageQueue. So we just store a pointer to EventData and manually free it in the destructor.
-            // FIXME: Use a lock-free queue implementation to completely eliminate contention when sending/receiving messages.
-            MessageQueue&lt;MessagePortChannel::EventData*&gt; m_queue;
</del><ins>+            MessageQueue&lt;MessagePortChannel::EventData&gt; m_queue;
</ins><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         ~PlatformMessagePortChannel();
</span></span></pre></div>
<a id="trunkWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/loader/FrameLoader.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/loader/FrameLoader.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/loader/FrameLoader.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -1694,9 +1694,9 @@
</span><span class="cx"> 
</span><span class="cx"> class HashChangeEventTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;HashChangeEventTask&gt; create(PassRefPtr&lt;Document&gt; document)
</del><ins>+    static PassOwnPtr&lt;HashChangeEventTask&gt; create(PassRefPtr&lt;Document&gt; document)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new HashChangeEventTask(document));
</del><ins>+        return new HashChangeEventTask(document);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     virtual void performTask(ScriptExecutionContext* context)
</span></span></pre></div>
<a id="trunkWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -947,9 +947,9 @@
</span><span class="cx"> 
</span><span class="cx"> class CallCacheListenerTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;CallCacheListenerTask&gt; create(PassRefPtr&lt;DocumentLoader&gt; loader, ApplicationCacheHost::EventID eventID)
</del><ins>+    static PassOwnPtr&lt;CallCacheListenerTask&gt; create(PassRefPtr&lt;DocumentLoader&gt; loader, ApplicationCacheHost::EventID eventID)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new CallCacheListenerTask(loader, eventID));
</del><ins>+        return new CallCacheListenerTask(loader, eventID);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual void performTask(ScriptExecutionContext* context)
</span></span></pre></div>
<a id="trunkWebCorestorageDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/Database.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/Database.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/Database.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -208,9 +208,9 @@
</span><span class="cx"> 
</span><span class="cx">     bool success = false;
</span><span class="cx">     DatabaseTaskSynchronizer synchronizer;
</span><del>-    RefPtr&lt;DatabaseOpenTask&gt; task = DatabaseOpenTask::create(this, &amp;synchronizer, e, success);
</del><ins>+    OwnPtr&lt;DatabaseOpenTask&gt; task = DatabaseOpenTask::create(this, &amp;synchronizer, e, success);
</ins><span class="cx"> 
</span><del>-    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task);
</del><ins>+    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task.release());
</ins><span class="cx">     synchronizer.waitForTaskCompletion();
</span><span class="cx"> 
</span><span class="cx">     return success;
</span><span class="lines">@@ -319,9 +319,9 @@
</span><span class="cx">     m_document-&gt;databaseThread()-&gt;unscheduleDatabaseTasks(this);
</span><span class="cx"> 
</span><span class="cx">     DatabaseTaskSynchronizer synchronizer;
</span><del>-    RefPtr&lt;DatabaseCloseTask&gt; task = DatabaseCloseTask::create(this, &amp;synchronizer);
</del><ins>+    OwnPtr&lt;DatabaseCloseTask&gt; task = DatabaseCloseTask::create(this, &amp;synchronizer);
</ins><span class="cx"> 
</span><del>-    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task);
</del><ins>+    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task.release());
</ins><span class="cx">     synchronizer.waitForTaskCompletion();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -539,7 +539,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (transaction &amp;&amp; m_document-&gt;databaseThread()) {
</span><del>-        RefPtr&lt;DatabaseTransactionTask&gt; task = DatabaseTransactionTask::create(transaction);
</del><ins>+        OwnPtr&lt;DatabaseTransactionTask&gt; task = DatabaseTransactionTask::create(transaction);
</ins><span class="cx">         LOG(StorageAPI, &quot;Scheduling DatabaseTransactionTask %p for transaction %p\n&quot;, task.get(), task-&gt;transaction());
</span><span class="cx">         m_transactionInProgress = true;
</span><span class="cx">         m_document-&gt;databaseThread()-&gt;scheduleTask(task.release());
</span><span class="lines">@@ -552,7 +552,7 @@
</span><span class="cx">     if (!m_document-&gt;databaseThread())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;DatabaseTransactionTask&gt; task = DatabaseTransactionTask::create(transaction);
</del><ins>+    OwnPtr&lt;DatabaseTransactionTask&gt; task = DatabaseTransactionTask::create(transaction);
</ins><span class="cx">     LOG(StorageAPI, &quot;Scheduling DatabaseTransactionTask %p for the transaction step\n&quot;, task.get());
</span><span class="cx">     if (immediately)
</span><span class="cx">         m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task.release());
</span><span class="lines">@@ -629,9 +629,9 @@
</span><span class="cx">         return result;
</span><span class="cx"> 
</span><span class="cx">     DatabaseTaskSynchronizer synchronizer;
</span><del>-    RefPtr&lt;DatabaseTableNamesTask&gt; task = DatabaseTableNamesTask::create(this, &amp;synchronizer, result);
</del><ins>+    OwnPtr&lt;DatabaseTableNamesTask&gt; task = DatabaseTableNamesTask::create(this, &amp;synchronizer, result);
</ins><span class="cx"> 
</span><del>-    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task);
</del><ins>+    m_document-&gt;databaseThread()-&gt;scheduleImmediateTask(task.release());
</ins><span class="cx">     synchronizer.waitForTaskCompletion();
</span><span class="cx"> 
</span><span class="cx">     return result;
</span></span></pre></div>
<a id="trunkWebCorestorageDatabaseTaskh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/DatabaseTask.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/DatabaseTask.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/DatabaseTask.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;PlatformString.h&quot;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><ins>+#include &lt;wtf/PassOwnPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx">     ThreadCondition m_synchronousCondition;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class DatabaseTask : public ThreadSafeShared&lt;DatabaseTask&gt; {
</del><ins>+class DatabaseTask : public Noncopyable {
</ins><span class="cx">     friend class Database;
</span><span class="cx"> public:
</span><span class="cx">     virtual ~DatabaseTask();
</span><span class="lines">@@ -91,9 +92,9 @@
</span><span class="cx"> 
</span><span class="cx"> class DatabaseOpenTask : public DatabaseTask {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DatabaseOpenTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer, ExceptionCode&amp; code, bool&amp; success)
</del><ins>+    static PassOwnPtr&lt;DatabaseOpenTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer, ExceptionCode&amp; code, bool&amp; success)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new DatabaseOpenTask(db, synchronizer, code, success));
</del><ins>+        return new DatabaseOpenTask(db, synchronizer, code, success);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -110,9 +111,9 @@
</span><span class="cx"> 
</span><span class="cx"> class DatabaseCloseTask : public DatabaseTask {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DatabaseCloseTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer)
</del><ins>+    static PassOwnPtr&lt;DatabaseCloseTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer)
</ins><span class="cx">     { 
</span><del>-        return adoptRef(new DatabaseCloseTask(db, synchronizer));
</del><ins>+        return new DatabaseCloseTask(db, synchronizer);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -127,9 +128,9 @@
</span><span class="cx"> class DatabaseTransactionTask : public DatabaseTask {
</span><span class="cx"> public:
</span><span class="cx">     // Transaction task is never synchronous, so no 'synchronizer' parameter.
</span><del>-    static PassRefPtr&lt;DatabaseTransactionTask&gt; create(PassRefPtr&lt;SQLTransaction&gt; transaction)
</del><ins>+    static PassOwnPtr&lt;DatabaseTransactionTask&gt; create(PassRefPtr&lt;SQLTransaction&gt; transaction)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new DatabaseTransactionTask(transaction));
</del><ins>+        return new DatabaseTransactionTask(transaction);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     SQLTransaction* transaction() const { return m_transaction.get(); }
</span><span class="lines">@@ -148,9 +149,9 @@
</span><span class="cx"> 
</span><span class="cx"> class DatabaseTableNamesTask : public DatabaseTask {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DatabaseTableNamesTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer, Vector&lt;String&gt;&amp; names)
</del><ins>+    static PassOwnPtr&lt;DatabaseTableNamesTask&gt; create(Database* db, DatabaseTaskSynchronizer* synchronizer, Vector&lt;String&gt;&amp; names)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new DatabaseTableNamesTask(db, synchronizer, names));
</del><ins>+        return new DatabaseTableNamesTask(db, synchronizer, names);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkWebCorestorageDatabaseThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/DatabaseThread.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/DatabaseThread.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/DatabaseThread.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -91,13 +91,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     AutodrainedPool pool;
</span><del>-    while (true) {
-        RefPtr&lt;DatabaseTask&gt; task;
-        if (!m_queue.waitForMessage(task))
-            break;
-
</del><ins>+    while (OwnPtr&lt;DatabaseTask&gt; task = m_queue.waitForMessage()) {
</ins><span class="cx">         task-&gt;performTask();
</span><del>-
</del><span class="cx">         pool.cycle();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -142,12 +137,12 @@
</span><span class="cx">     m_openDatabaseSet.remove(database);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DatabaseThread::scheduleTask(PassRefPtr&lt;DatabaseTask&gt; task)
</del><ins>+void DatabaseThread::scheduleTask(PassOwnPtr&lt;DatabaseTask&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     m_queue.append(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DatabaseThread::scheduleImmediateTask(PassRefPtr&lt;DatabaseTask&gt; task)
</del><ins>+void DatabaseThread::scheduleImmediateTask(PassOwnPtr&lt;DatabaseTask&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     m_queue.prepend(task);
</span><span class="cx"> }
</span><span class="lines">@@ -155,7 +150,7 @@
</span><span class="cx"> class SameDatabasePredicate {
</span><span class="cx"> public:
</span><span class="cx">     SameDatabasePredicate(const Database* database) : m_database(database) { }
</span><del>-    bool operator()(RefPtr&lt;DatabaseTask&gt;&amp; task) const { return task-&gt;database() == m_database; }
</del><ins>+    bool operator()(DatabaseTask* task) const { return task-&gt;database() == m_database; }
</ins><span class="cx"> private:
</span><span class="cx">     const Database* m_database;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkWebCorestorageDatabaseThreadh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/DatabaseThread.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/DatabaseThread.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/DatabaseThread.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><ins>+#include &lt;wtf/PassOwnPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="lines">@@ -55,8 +56,8 @@
</span><span class="cx">     void requestTermination();
</span><span class="cx">     bool terminationRequested() const;
</span><span class="cx"> 
</span><del>-    void scheduleTask(PassRefPtr&lt;DatabaseTask&gt;);
-    void scheduleImmediateTask(PassRefPtr&lt;DatabaseTask&gt;); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion.
</del><ins>+    void scheduleTask(PassOwnPtr&lt;DatabaseTask&gt;);
+    void scheduleImmediateTask(PassOwnPtr&lt;DatabaseTask&gt;); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion.
</ins><span class="cx">     void unscheduleDatabaseTasks(Database*);
</span><span class="cx"> 
</span><span class="cx">     void recordDatabaseOpen(Database*);
</span><span class="lines">@@ -76,7 +77,7 @@
</span><span class="cx">     ThreadIdentifier m_threadID;
</span><span class="cx">     RefPtr&lt;DatabaseThread&gt; m_selfRef;
</span><span class="cx"> 
</span><del>-    MessageQueue&lt;RefPtr&lt;DatabaseTask&gt; &gt; m_queue;
</del><ins>+    MessageQueue&lt;DatabaseTask&gt; m_queue;
</ins><span class="cx"> 
</span><span class="cx">     // This set keeps track of the open databases that have been used on this thread.
</span><span class="cx">     typedef HashSet&lt;RefPtr&lt;Database&gt; &gt; DatabaseSet;
</span></span></pre></div>
<a id="trunkWebCorestorageLocalStorageTaskh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/LocalStorageTask.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/LocalStorageTask.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/LocalStorageTask.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -28,8 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DOM_STORAGE)
</span><span class="cx"> 
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
</del><ins>+#include &lt;wtf/PassOwnPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -44,9 +43,9 @@
</span><span class="cx"> 
</span><span class="cx">         ~LocalStorageTask();
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;LocalStorageTask&gt; createImport(StorageAreaSync* area) { return adoptRef(new LocalStorageTask(AreaImport, area)); }
-        static PassRefPtr&lt;LocalStorageTask&gt; createSync(StorageAreaSync* area) { return adoptRef(new LocalStorageTask(AreaSync, area)); }
-        static PassRefPtr&lt;LocalStorageTask&gt; createTerminate(LocalStorageThread* thread) { return adoptRef(new LocalStorageTask(TerminateThread, thread)); }
</del><ins>+        static PassOwnPtr&lt;LocalStorageTask&gt; createImport(StorageAreaSync* area) { return new LocalStorageTask(AreaImport, area); }
+        static PassOwnPtr&lt;LocalStorageTask&gt; createSync(StorageAreaSync* area) { return new LocalStorageTask(AreaSync, area); }
+        static PassOwnPtr&lt;LocalStorageTask&gt; createTerminate(LocalStorageThread* thread) { return new LocalStorageTask(TerminateThread, thread); }
</ins><span class="cx"> 
</span><span class="cx">         void performTask();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorestorageLocalStorageThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/LocalStorageThread.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/LocalStorageThread.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/LocalStorageThread.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -69,13 +69,8 @@
</span><span class="cx">         MutexLocker lock(m_threadCreationMutex);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    while (true) {
-        RefPtr&lt;LocalStorageTask&gt; task;
-        if (!m_queue.waitForMessage(task))
-            break;
-
</del><ins>+    while (OwnPtr&lt;LocalStorageTask&gt; task = m_queue.waitForMessage())
</ins><span class="cx">         task-&gt;performTask();
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     // Detach the thread so its resources are no longer of any concern to anyone else
</span><span class="cx">     detachThread(m_threadID);
</span></span></pre></div>
<a id="trunkWebCorestorageLocalStorageThreadh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/storage/LocalStorageThread.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/storage/LocalStorageThread.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/storage/LocalStorageThread.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">         ThreadIdentifier m_threadID;
</span><span class="cx">         RefPtr&lt;LocalStorageThread&gt; m_selfRef;
</span><span class="cx"> 
</span><del>-        MessageQueue&lt;RefPtr&lt;LocalStorageTask&gt; &gt; m_queue;
</del><ins>+        MessageQueue&lt;LocalStorageTask&gt; m_queue;
</ins><span class="cx"> 
</span><span class="cx">         Mutex m_terminateLock;
</span><span class="cx">         ThreadCondition m_terminateCondition;
</span></span></pre></div>
<a id="trunkWebCorewebsocketsWebSocketcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/websockets/WebSocket.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/websockets/WebSocket.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/websockets/WebSocket.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -52,9 +52,9 @@
</span><span class="cx"> class ProcessWebSocketEventTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><span class="cx">     typedef void (WebSocket::*Method)(Event*);
</span><del>-    static PassRefPtr&lt;ProcessWebSocketEventTask&gt; create(PassRefPtr&lt;WebSocket&gt; webSocket, PassRefPtr&lt;Event&gt; event)
</del><ins>+    static PassOwnPtr&lt;ProcessWebSocketEventTask&gt; create(PassRefPtr&lt;WebSocket&gt; webSocket, PassRefPtr&lt;Event&gt; event)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new ProcessWebSocketEventTask(webSocket, event));
</del><ins>+        return new ProcessWebSocketEventTask(webSocket, event);
</ins><span class="cx">     }
</span><span class="cx">     virtual void performTask(ScriptExecutionContext*)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkWebCoreworkersDefaultSharedWorkerRepositorycpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/DefaultSharedWorkerRepository.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/DefaultSharedWorkerRepository.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/DefaultSharedWorkerRepository.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -73,8 +73,8 @@
</span><span class="cx">     bool matches(const String&amp; name, PassRefPtr&lt;SecurityOrigin&gt; origin, const KURL&amp; urlToMatch) const;
</span><span class="cx"> 
</span><span class="cx">     // WorkerLoaderProxy
</span><del>-    virtual void postTaskToLoader(PassRefPtr&lt;ScriptExecutionContext::Task&gt;);
-    virtual void postTaskForModeToWorkerContext(PassRefPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp;);
</del><ins>+    virtual void postTaskToLoader(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;);
+    virtual void postTaskForModeToWorkerContext(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // WorkerReportingProxy
</span><span class="cx">     virtual void postExceptionToWorkerObject(const String&amp; errorMessage, int lineNumber, const String&amp; sourceURL);
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     return name == m_name;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SharedWorkerProxy::postTaskToLoader(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task)
</del><ins>+void SharedWorkerProxy::postTaskToLoader(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     MutexLocker lock(m_workerDocumentsLock);
</span><span class="cx"> 
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">     document-&gt;postTask(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SharedWorkerProxy::postTaskForModeToWorkerContext(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</del><ins>+void SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</ins><span class="cx"> {
</span><span class="cx">     if (isClosing())
</span><span class="cx">         return;
</span><span class="lines">@@ -221,9 +221,9 @@
</span><span class="cx"> 
</span><span class="cx"> class SharedWorkerConnectTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;SharedWorkerConnectTask&gt; create(PassOwnPtr&lt;MessagePortChannel&gt; channel)
</del><ins>+    static PassOwnPtr&lt;SharedWorkerConnectTask&gt; create(PassOwnPtr&lt;MessagePortChannel&gt; channel)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new SharedWorkerConnectTask(channel));
</del><ins>+        return new SharedWorkerConnectTask(channel);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkWebCoreworkersGenericWorkerTaskh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/GenericWorkerTask.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/GenericWorkerTask.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/GenericWorkerTask.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -70,9 +70,9 @@
</span><span class="cx">         typedef GenericWorkerTask1&lt;P1, MP1&gt; GenericWorkerTask;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P1&gt;::ParamType Param1;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1));
</del><ins>+            return new GenericWorkerTask(method, parameter1);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -100,9 +100,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P1&gt;::ParamType Param1;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P2&gt;::ParamType Param2;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -133,9 +133,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P2&gt;::ParamType Param2;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P3&gt;::ParamType Param3;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -169,9 +169,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P3&gt;::ParamType Param3;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P4&gt;::ParamType Param4;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -208,9 +208,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P4&gt;::ParamType Param4;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P5&gt;::ParamType Param5;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -250,9 +250,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P5&gt;::ParamType Param5;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P6&gt;::ParamType Param6;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -295,9 +295,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P6&gt;::ParamType Param6;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P7&gt;::ParamType Param7;
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -343,9 +343,9 @@
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P7&gt;::ParamType Param7;
</span><span class="cx">         typedef typename GenericWorkerTaskTraits&lt;P8&gt;::ParamType Param8;
</span><span class="cx">         
</span><del>-        static PassRefPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
</del><ins>+        static PassOwnPtr&lt;GenericWorkerTask&gt; create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8));
</del><ins>+            return new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8);
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">     private:
</span><span class="lines">@@ -380,7 +380,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1),
</span><span class="cx">         const P1&amp; parameter1)
</span><span class="cx">     {
</span><span class="lines">@@ -390,7 +390,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2)
</span><span class="cx">     {
</span><span class="lines">@@ -400,7 +400,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2, MP3),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3)
</span><span class="cx">     {
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3, const P4&amp; parameter4)
</span><span class="cx">     {
</span><span class="lines">@@ -423,7 +423,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3, const P4&amp; parameter4, const P5&amp; parameter5)
</span><span class="cx">     {
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3, const P4&amp; parameter4, const P5&amp; parameter5, const P6&amp; parameter6)
</span><span class="cx">     {
</span><span class="lines">@@ -449,7 +449,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">         void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7),
</span><span class="cx">         const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3, const P4&amp; parameter4, const P5&amp; parameter5, const P6&amp; parameter6, const P7&amp; parameter7)
</span><span class="cx">     {
</span><span class="lines">@@ -464,7 +464,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8&gt;
</span><del>-    PassRefPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</del><ins>+    PassOwnPtr&lt;ScriptExecutionContext::Task&gt; createCallbackTask(
</ins><span class="cx">                                                                 void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
</span><span class="cx">                                                                 const P1&amp; parameter1, const P2&amp; parameter2, const P3&amp; parameter3, const P4&amp; parameter4, const P5&amp; parameter5, const P6&amp; parameter6, const P7&amp; parameter7, const P8&amp; parameter8)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerContext.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerContext.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerContext.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerContext::postTask(PassRefPtr&lt;Task&gt; task)
</del><ins>+void WorkerContext::postTask(PassOwnPtr&lt;Task&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     thread()-&gt;runLoop().postTask(task);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerContexth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerContext.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerContext.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerContext.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">         virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString&amp; sourceString);
</span><span class="cx">         virtual void scriptImported(unsigned long identifier, const String&amp; sourceString);
</span><span class="cx"> 
</span><del>-        virtual void postTask(PassRefPtr&lt;Task&gt;); // Executes the task on context's thread asynchronously.
</del><ins>+        virtual void postTask(PassOwnPtr&lt;Task&gt;); // Executes the task on context's thread asynchronously.
</ins><span class="cx"> 
</span><span class="cx">         // WorkerGlobalScope
</span><span class="cx">         WorkerContext* self() { return this; }
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerLoaderProxyh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerLoaderProxy.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerLoaderProxy.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerLoaderProxy.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> #if ENABLE(WORKERS)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
</del><ins>+#include &lt;wtf/PassOwnPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -50,11 +50,11 @@
</span><span class="cx">         virtual ~WorkerLoaderProxy() { }
</span><span class="cx"> 
</span><span class="cx">         // Posts a task to the thread which runs the loading code (normally, the main thread).
</span><del>-        virtual void postTaskToLoader(PassRefPtr&lt;ScriptExecutionContext::Task&gt;) = 0;
</del><ins>+        virtual void postTaskToLoader(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;) = 0;
</ins><span class="cx"> 
</span><span class="cx">         // Posts callbacks from loading code to the WorkerContext. The 'mode' is used to differentiate
</span><span class="cx">         // specific synchronous loading requests so they can be 'nested', per spec.
</span><del>-        virtual void postTaskForModeToWorkerContext(PassRefPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode) = 0;
</del><ins>+        virtual void postTaskForModeToWorkerContext(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode) = 0;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerMessagingProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerMessagingProxy.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerMessagingProxy.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerMessagingProxy.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -46,9 +46,9 @@
</span><span class="cx"> 
</span><span class="cx"> class MessageWorkerContextTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;MessageWorkerContextTask&gt; create(PassRefPtr&lt;SerializedScriptValue&gt; message, PassOwnPtr&lt;MessagePortChannelArray&gt; channels)
</del><ins>+    static PassOwnPtr&lt;MessageWorkerContextTask&gt; create(PassRefPtr&lt;SerializedScriptValue&gt; message, PassOwnPtr&lt;MessagePortChannelArray&gt; channels)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new MessageWorkerContextTask(message, channels));
</del><ins>+        return new MessageWorkerContextTask(message, channels);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -74,9 +74,9 @@
</span><span class="cx"> 
</span><span class="cx"> class MessageWorkerTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;MessageWorkerTask&gt; create(PassRefPtr&lt;SerializedScriptValue&gt; message, PassOwnPtr&lt;MessagePortChannelArray&gt; channels, WorkerMessagingProxy* messagingProxy)
</del><ins>+    static PassOwnPtr&lt;MessageWorkerTask&gt; create(PassRefPtr&lt;SerializedScriptValue&gt; message, PassOwnPtr&lt;MessagePortChannelArray&gt; channels, WorkerMessagingProxy* messagingProxy)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new MessageWorkerTask(message, channels, messagingProxy));
</del><ins>+        return new MessageWorkerTask(message, channels, messagingProxy);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -105,9 +105,9 @@
</span><span class="cx"> 
</span><span class="cx"> class WorkerExceptionTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WorkerExceptionTask&gt; create(const String&amp; errorMessage, int lineNumber, const String&amp; sourceURL, WorkerMessagingProxy* messagingProxy)
</del><ins>+    static PassOwnPtr&lt;WorkerExceptionTask&gt; create(const String&amp; errorMessage, int lineNumber, const String&amp; sourceURL, WorkerMessagingProxy* messagingProxy)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new WorkerExceptionTask(errorMessage, lineNumber, sourceURL, messagingProxy));
</del><ins>+        return new WorkerExceptionTask(errorMessage, lineNumber, sourceURL, messagingProxy);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -141,9 +141,9 @@
</span><span class="cx"> 
</span><span class="cx"> class WorkerContextDestroyedTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WorkerContextDestroyedTask&gt; create(WorkerMessagingProxy* messagingProxy)
</del><ins>+    static PassOwnPtr&lt;WorkerContextDestroyedTask&gt; create(WorkerMessagingProxy* messagingProxy)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new WorkerContextDestroyedTask(messagingProxy));
</del><ins>+        return new WorkerContextDestroyedTask(messagingProxy);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -162,9 +162,9 @@
</span><span class="cx"> 
</span><span class="cx"> class WorkerTerminateTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WorkerTerminateTask&gt; create(WorkerMessagingProxy* messagingProxy)
</del><ins>+    static PassOwnPtr&lt;WorkerTerminateTask&gt; create(WorkerMessagingProxy* messagingProxy)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new WorkerTerminateTask(messagingProxy));
</del><ins>+        return new WorkerTerminateTask(messagingProxy);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -183,9 +183,9 @@
</span><span class="cx"> 
</span><span class="cx"> class WorkerThreadActivityReportTask : public ScriptExecutionContext::Task {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;WorkerThreadActivityReportTask&gt; create(WorkerMessagingProxy* messagingProxy, bool confirmingMessage, bool hasPendingActivity)
</del><ins>+    static PassOwnPtr&lt;WorkerThreadActivityReportTask&gt; create(WorkerMessagingProxy* messagingProxy, bool confirmingMessage, bool hasPendingActivity)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new WorkerThreadActivityReportTask(messagingProxy, confirmingMessage, hasPendingActivity));
</del><ins>+        return new WorkerThreadActivityReportTask(messagingProxy, confirmingMessage, hasPendingActivity);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -257,7 +257,7 @@
</span><span class="cx">         m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, channels.release()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerMessagingProxy::postTaskForModeToWorkerContext(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</del><ins>+void WorkerMessagingProxy::postTaskForModeToWorkerContext(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</ins><span class="cx"> {
</span><span class="cx">     if (m_askedToTerminate)
</span><span class="cx">         return;
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx">     m_workerThread-&gt;runLoop().postTaskForMode(task, mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerMessagingProxy::postTaskToLoader(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task)
</del><ins>+void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: In case of nested workers, this should go directly to the root Document context.
</span><span class="cx">     ASSERT(m_scriptExecutionContext-&gt;isDocument());
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx">         m_workerThreadHadPendingActivity = true; // Worker initialization means a pending activity.
</span><span class="cx"> 
</span><span class="cx">         for (unsigned i = 0; i &lt; taskCount; ++i)
</span><del>-            m_workerThread-&gt;runLoop().postTask(m_queuedEarlyTasks[i]);
</del><ins>+            m_workerThread-&gt;runLoop().postTask(m_queuedEarlyTasks[i].release());
</ins><span class="cx">         m_queuedEarlyTasks.clear();
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerMessagingProxyh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerMessagingProxy.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerMessagingProxy.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerMessagingProxy.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -71,8 +71,8 @@
</span><span class="cx">         // Implementation of WorkerLoaderProxy.
</span><span class="cx">         // These methods are called on different threads to schedule loading
</span><span class="cx">         // requests and to send callbacks back to WorkerContext.
</span><del>-        virtual void postTaskToLoader(PassRefPtr&lt;ScriptExecutionContext::Task&gt;);
-        virtual void postTaskForModeToWorkerContext(PassRefPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode);
</del><ins>+        virtual void postTaskToLoader(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;);
+        virtual void postTaskForModeToWorkerContext(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode);
</ins><span class="cx"> 
</span><span class="cx">         void workerThreadCreated(PassRefPtr&lt;DedicatedWorkerThread&gt;);
</span><span class="cx"> 
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool m_askedToTerminate;
</span><span class="cx"> 
</span><del>-        Vector&lt;RefPtr&lt;ScriptExecutionContext::Task&gt; &gt; m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
</del><ins>+        Vector&lt;OwnPtr&lt;ScriptExecutionContext::Task&gt; &gt; m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerRunLoopcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerRunLoop.cpp (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerRunLoop.cpp        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerRunLoop.cpp        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -64,27 +64,6 @@
</span><span class="cx">     double m_nextFireTime;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class WorkerRunLoop::Task : public RefCounted&lt;Task&gt; {
-public:
-    static PassRefPtr&lt;Task&gt; create(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
-    {
-        return adoptRef(new Task(task, mode));
-    }
-
-    const String&amp; mode() const { return m_mode; }
-    void performTask(ScriptExecutionContext* context) { m_task-&gt;performTask(context); }
-
-private:
-    Task(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
-        : m_task(task)
-        , m_mode(mode.crossThreadString())
-    {
-    }
-
-    RefPtr&lt;ScriptExecutionContext::Task&gt; m_task;
-    String m_mode;
-};
-
</del><span class="cx"> class ModePredicate {
</span><span class="cx"> public:
</span><span class="cx">     ModePredicate(const String&amp; mode)
</span><span class="lines">@@ -98,7 +77,7 @@
</span><span class="cx">         return m_defaultMode;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator()(PassRefPtr&lt;WorkerRunLoop::Task&gt; task) const
</del><ins>+    bool operator()(WorkerRunLoop::Task* task) const
</ins><span class="cx">     {
</span><span class="cx">         return m_defaultMode || m_mode == task-&gt;mode();
</span><span class="cx">     }
</span><span class="lines">@@ -169,9 +148,9 @@
</span><span class="cx">     ASSERT(context-&gt;thread());
</span><span class="cx">     ASSERT(context-&gt;thread()-&gt;threadID() == currentThread());
</span><span class="cx"> 
</span><del>-    double absoluteTime = (predicate.isDefaultMode() &amp;&amp; m_sharedTimer-&gt;isActive()) ? m_sharedTimer-&gt;fireTime() : MessageQueue&lt;RefPtr&lt;Task&gt; &gt;::infiniteTime();
-    RefPtr&lt;Task&gt; task;
-    MessageQueueWaitResult result = m_messageQueue.waitForMessageFilteredWithTimeout(task, predicate, absoluteTime);
</del><ins>+    double absoluteTime = (predicate.isDefaultMode() &amp;&amp; m_sharedTimer-&gt;isActive()) ? m_sharedTimer-&gt;fireTime() : MessageQueue&lt;Task&gt;::infiniteTime();
+    MessageQueueWaitResult result;
+    OwnPtr&lt;WorkerRunLoop::Task&gt; task = m_messageQueue.waitForMessageFilteredWithTimeout(result, predicate, absoluteTime);
</ins><span class="cx"> 
</span><span class="cx">     // If the context is closing, don't dispatch any further tasks (per section 4.1.1 of the Web Workers spec).
</span><span class="cx">     if (context-&gt;isClosing())
</span><span class="lines">@@ -198,16 +177,33 @@
</span><span class="cx">     m_messageQueue.kill();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerRunLoop::postTask(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task)
</del><ins>+void WorkerRunLoop::postTask(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task)
</ins><span class="cx"> {
</span><span class="cx">     postTaskForMode(task, defaultMode());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerRunLoop::postTaskForMode(PassRefPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</del><ins>+void WorkerRunLoop::postTaskForMode(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
</ins><span class="cx"> {
</span><span class="cx">     m_messageQueue.append(Task::create(task, mode.crossThreadString()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassOwnPtr&lt;WorkerRunLoop::Task&gt; WorkerRunLoop::Task::create(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
+{
+    return new Task(task, mode);
+}
+
+void WorkerRunLoop::Task::performTask(ScriptExecutionContext* context)
+{
+    m_task-&gt;performTask(context);
+}
+
+WorkerRunLoop::Task::Task(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode)
+    : m_task(task)
+    , m_mode(mode.crossThreadString())
+{
+}
+
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WORKERS)
</span></span></pre></div>
<a id="trunkWebCoreworkersWorkerRunLooph"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/workers/WorkerRunLoop.h (50426 => 50427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/workers/WorkerRunLoop.h        2009-11-02 21:14:00 UTC (rev 50426)
+++ trunk/WebCore/workers/WorkerRunLoop.h        2009-11-02 21:31:22 UTC (rev 50427)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
</del><ins>+#include &lt;wtf/PassOwnPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -58,18 +58,32 @@
</span><span class="cx">         void terminate();
</span><span class="cx">         bool terminated() { return m_messageQueue.killed(); }
</span><span class="cx"> 
</span><del>-        void postTask(PassRefPtr&lt;ScriptExecutionContext::Task&gt;);
-        void postTaskForMode(PassRefPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode);
</del><ins>+        void postTask(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;);
+        void postTaskForMode(PassOwnPtr&lt;ScriptExecutionContext::Task&gt;, const String&amp; mode);
</ins><span class="cx"> 
</span><span class="cx">         unsigned long createUniqueId() { return ++m_uniqueId; }
</span><span class="cx"> 
</span><span class="cx">         static String defaultMode();
</span><del>-        class Task;
</del><ins>+
+        class Task : public Noncopyable {
+        public:
+            static PassOwnPtr&lt;Task&gt; create(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode);
+            ~Task() { }
+            const String&amp; mode() const { return m_mode; }
+            void performTask(ScriptExecutionContext* context);
+
+        private:
+            Task(PassOwnPtr&lt;ScriptExecutionContext::Task&gt; task, const String&amp; mode);
+        
+            OwnPtr&lt;ScriptExecutionContext::Task&gt; m_task;
+            String m_mode;
+        };
+
</ins><span class="cx">     private:
</span><span class="cx">         friend class RunLoopSetup;
</span><span class="cx">         MessageQueueWaitResult runInMode(WorkerContext*, const ModePredicate&amp;);
</span><span class="cx"> 
</span><del>-        MessageQueue&lt;RefPtr&lt;Task&gt; &gt; m_messageQueue;
</del><ins>+        MessageQueue&lt;Task&gt; m_messageQueue;
</ins><span class="cx">         OwnPtr&lt;WorkerSharedTimer&gt; m_sharedTimer;
</span><span class="cx">         int m_nestedCount;
</span><span class="cx">         unsigned long m_uniqueId;
</span></span></pre>
</div>
</div>

</body>
</html>