Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: Source/WebCore/workers/WorkerRunLoop.cpp

Issue 12096050: Merge 140483 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/workers/WorkerRunLoop.h ('k') | Source/WebCore/workers/WorkerThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void WorkerRunLoop::terminate() 194 void WorkerRunLoop::terminate()
195 { 195 {
196 m_messageQueue.kill(); 196 m_messageQueue.kill();
197 } 197 }
198 198
199 void WorkerRunLoop::postTask(PassOwnPtr<ScriptExecutionContext::Task> task) 199 void WorkerRunLoop::postTask(PassOwnPtr<ScriptExecutionContext::Task> task)
200 { 200 {
201 postTaskForMode(task, defaultMode()); 201 postTaskForMode(task, defaultMode());
202 } 202 }
203 203
204 void WorkerRunLoop::postTaskAndTerminate(PassOwnPtr<ScriptExecutionContext::Task > task)
205 {
206 m_messageQueue.appendAndKill(Task::create(task, defaultMode().isolatedCopy() ));
207 }
208
204 void WorkerRunLoop::postTaskForMode(PassOwnPtr<ScriptExecutionContext::Task> tas k, const String& mode) 209 void WorkerRunLoop::postTaskForMode(PassOwnPtr<ScriptExecutionContext::Task> tas k, const String& mode)
205 { 210 {
206 m_messageQueue.append(Task::create(task, mode.isolatedCopy())); 211 m_messageQueue.append(Task::create(task, mode.isolatedCopy()));
207 } 212 }
208 213
209 PassOwnPtr<WorkerRunLoop::Task> WorkerRunLoop::Task::create(PassOwnPtr<ScriptExe cutionContext::Task> task, const String& mode) 214 PassOwnPtr<WorkerRunLoop::Task> WorkerRunLoop::Task::create(PassOwnPtr<ScriptExe cutionContext::Task> task, const String& mode)
210 { 215 {
211 return adoptPtr(new Task(task, mode)); 216 return adoptPtr(new Task(task, mode));
212 } 217 }
213 218
214 void WorkerRunLoop::Task::performTask(const WorkerRunLoop& runLoop, ScriptExecut ionContext* context) 219 void WorkerRunLoop::Task::performTask(const WorkerRunLoop& runLoop, ScriptExecut ionContext* context)
215 { 220 {
216 WorkerContext* workerContext = static_cast<WorkerContext *>(context); 221 WorkerContext* workerContext = static_cast<WorkerContext *>(context);
217 if ((!workerContext->isClosing() && !runLoop.terminated()) || m_task->isClea nupTask()) 222 if ((!workerContext->isClosing() && !runLoop.terminated()) || m_task->isClea nupTask())
218 m_task->performTask(context); 223 m_task->performTask(context);
219 } 224 }
220 225
221 WorkerRunLoop::Task::Task(PassOwnPtr<ScriptExecutionContext::Task> task, const S tring& mode) 226 WorkerRunLoop::Task::Task(PassOwnPtr<ScriptExecutionContext::Task> task, const S tring& mode)
222 : m_task(task) 227 : m_task(task)
223 , m_mode(mode.isolatedCopy()) 228 , m_mode(mode.isolatedCopy())
224 { 229 {
225 } 230 }
226 231
227 } // namespace WebCore 232 } // namespace WebCore
228 233
229 #endif // ENABLE(WORKERS) 234 #endif // ENABLE(WORKERS)
OLDNEW
« no previous file with comments | « Source/WebCore/workers/WorkerRunLoop.h ('k') | Source/WebCore/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698