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

Side by Side Diff: Source/core/workers/WorkerEventQueue.cpp

Issue 915703002: Add task location information to ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/testing/NullExecutionContext.cpp ('k') | Source/core/workers/WorkerGlobalScope.h » ('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) 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 bool WorkerEventQueue::enqueueEvent(PassRefPtrWillBeRawPtr<Event> prpEvent) 114 bool WorkerEventQueue::enqueueEvent(PassRefPtrWillBeRawPtr<Event> prpEvent)
115 { 115 {
116 if (m_isClosed) 116 if (m_isClosed)
117 return false; 117 return false;
118 RefPtrWillBeRawPtr<Event> event = prpEvent; 118 RefPtrWillBeRawPtr<Event> event = prpEvent;
119 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get()); 119 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get());
120 OwnPtr<EventDispatcherTask> task = EventDispatcherTask::create(event, this); 120 OwnPtr<EventDispatcherTask> task = EventDispatcherTask::create(event, this);
121 m_eventTaskMap.add(event.release(), task.get()); 121 m_eventTaskMap.add(event.release(), task.get());
122 m_executionContext->postTask(task.release()); 122 m_executionContext->postTask(FROM_HERE, task.release());
123 return true; 123 return true;
124 } 124 }
125 125
126 bool WorkerEventQueue::cancelEvent(Event* event) 126 bool WorkerEventQueue::cancelEvent(Event* event)
127 { 127 {
128 EventDispatcherTask* task = m_eventTaskMap.get(event); 128 EventDispatcherTask* task = m_eventTaskMap.get(event);
129 if (!task) 129 if (!task)
130 return false; 130 return false;
131 task->cancel(); 131 task->cancel();
132 removeEvent(event); 132 removeEvent(event);
133 return true; 133 return true;
134 } 134 }
135 135
136 void WorkerEventQueue::close() 136 void WorkerEventQueue::close()
137 { 137 {
138 m_isClosed = true; 138 m_isClosed = true;
139 for (const auto& entry : m_eventTaskMap) { 139 for (const auto& entry : m_eventTaskMap) {
140 Event* event = entry.key.get(); 140 Event* event = entry.key.get();
141 EventDispatcherTask* task = entry.value; 141 EventDispatcherTask* task = entry.value;
142 InspectorInstrumentation::didRemoveEvent(event->target(), event); 142 InspectorInstrumentation::didRemoveEvent(event->target(), event);
143 task->cancel(); 143 task->cancel();
144 } 144 }
145 m_eventTaskMap.clear(); 145 m_eventTaskMap.clear();
146 } 146 }
147 147
148 } 148 }
OLDNEW
« no previous file with comments | « Source/core/testing/NullExecutionContext.cpp ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698