| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/workers/WorkerEventQueue.h" | 28 #include "core/workers/WorkerEventQueue.h" |
| 29 | 29 |
| 30 #include "core/dom/ExecutionContext.h" | 30 #include "core/dom/ExecutionContext.h" |
| 31 #include "core/dom/ExecutionContextTask.h" | 31 #include "core/dom/ExecutionContextTask.h" |
| 32 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 PassOwnPtr<WorkerEventQueue> WorkerEventQueue::create(ExecutionContext* context) | 36 PassOwnPtrWillBeRawPtr<WorkerEventQueue> WorkerEventQueue::create(ExecutionConte
xt* context) |
| 37 { | 37 { |
| 38 return adoptPtr(new WorkerEventQueue(context)); | 38 return adoptPtrWillBeNoop(new WorkerEventQueue(context)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 WorkerEventQueue::WorkerEventQueue(ExecutionContext* context) | 41 WorkerEventQueue::WorkerEventQueue(ExecutionContext* context) |
| 42 : m_executionContext(context) | 42 : m_executionContext(context) |
| 43 , m_isClosed(false) | 43 , m_isClosed(false) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 WorkerEventQueue::~WorkerEventQueue() | 47 WorkerEventQueue::~WorkerEventQueue() |
| 48 { | 48 { |
| 49 close(); | 49 ASSERT(m_eventTaskMap.isEmpty()); |
| 50 } |
| 51 |
| 52 void WorkerEventQueue::trace(Visitor* visitor) |
| 53 { |
| 54 visitor->trace(m_eventTaskMap); |
| 50 } | 55 } |
| 51 | 56 |
| 52 class WorkerEventQueue::EventDispatcherTask : public ExecutionContextTask { | 57 class WorkerEventQueue::EventDispatcherTask : public ExecutionContextTask { |
| 53 public: | 58 public: |
| 54 static PassOwnPtr<EventDispatcherTask> create(PassRefPtrWillBeRawPtr<Event>
event, WorkerEventQueue* eventQueue) | 59 static PassOwnPtr<EventDispatcherTask> create(PassRefPtrWillBeRawPtr<Event>
event, WorkerEventQueue* eventQueue) |
| 55 { | 60 { |
| 56 return adoptPtr(new EventDispatcherTask(event, eventQueue)); | 61 return adoptPtr(new EventDispatcherTask(event, eventQueue)); |
| 57 } | 62 } |
| 58 | 63 |
| 59 virtual ~EventDispatcherTask() | 64 virtual ~EventDispatcherTask() |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 { | 130 { |
| 126 m_isClosed = true; | 131 m_isClosed = true; |
| 127 for (EventTaskMap::iterator it = m_eventTaskMap.begin(); it != m_eventTaskMa
p.end(); ++it) { | 132 for (EventTaskMap::iterator it = m_eventTaskMap.begin(); it != m_eventTaskMa
p.end(); ++it) { |
| 128 EventDispatcherTask* task = it->value; | 133 EventDispatcherTask* task = it->value; |
| 129 task->cancel(); | 134 task->cancel(); |
| 130 } | 135 } |
| 131 m_eventTaskMap.clear(); | 136 m_eventTaskMap.clear(); |
| 132 } | 137 } |
| 133 | 138 |
| 134 } | 139 } |
| OLD | NEW |