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

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

Issue 899923004: Add task location information to WorkerThread (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/workers/WorkerInspectorProxy.cpp ('k') | Source/core/workers/WorkerThread.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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message) ); 140 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message) );
141 } 141 }
142 142
143 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedS criptValue> message, PassOwnPtr<MessagePortChannelArray> channels) 143 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedS criptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
144 { 144 {
145 if (m_askedToTerminate) 145 if (m_askedToTerminate)
146 return; 146 return;
147 147
148 if (m_workerThread) { 148 if (m_workerThread) {
149 ++m_unconfirmedMessageCount; 149 ++m_unconfirmedMessageCount;
150 m_workerThread->postTask(MessageWorkerGlobalScopeTask::create(message, c hannels)); 150 m_workerThread->postTask(FROM_HERE, MessageWorkerGlobalScopeTask::create (message, channels));
151 } else 151 } else
152 m_queuedEarlyTasks.append(MessageWorkerGlobalScopeTask::create(message, channels)); 152 m_queuedEarlyTasks.append(MessageWorkerGlobalScopeTask::create(message, channels));
153 } 153 }
154 154
155 bool WorkerMessagingProxy::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionConte xtTask> task) 155 bool WorkerMessagingProxy::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionConte xtTask> task)
156 { 156 {
157 if (m_askedToTerminate) 157 if (m_askedToTerminate)
158 return false; 158 return false;
159 159
160 ASSERT(m_workerThread); 160 ASSERT(m_workerThread);
161 m_workerThread->postTask(task); 161 m_workerThread->postTask(FROM_HERE, task);
162 return true; 162 return true;
163 } 163 }
164 164
165 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ExecutionContextTask> tas k) 165 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ExecutionContextTask> tas k)
166 { 166 {
167 // FIXME: In case of nested workers, this should go directly to the root Doc ument context. 167 // FIXME: In case of nested workers, this should go directly to the root Doc ument context.
168 ASSERT(m_executionContext->isDocument()); 168 ASSERT(m_executionContext->isDocument());
169 m_executionContext->postTask(FROM_HERE, task); 169 m_executionContext->postTask(FROM_HERE, task);
170 } 170 }
171 171
(...skipping 30 matching lines...) Expand all
202 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread) 202 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread)
203 { 203 {
204 ASSERT(!m_askedToTerminate); 204 ASSERT(!m_askedToTerminate);
205 m_workerThread = workerThread; 205 m_workerThread = workerThread;
206 206
207 ASSERT(!m_unconfirmedMessageCount); 207 ASSERT(!m_unconfirmedMessageCount);
208 m_unconfirmedMessageCount = m_queuedEarlyTasks.size(); 208 m_unconfirmedMessageCount = m_queuedEarlyTasks.size();
209 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe nding activity. 209 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe nding activity.
210 210
211 for (auto& earlyTasks : m_queuedEarlyTasks) 211 for (auto& earlyTasks : m_queuedEarlyTasks)
212 m_workerThread->postTask(earlyTasks.release()); 212 m_workerThread->postTask(FROM_HERE, earlyTasks.release());
213 m_queuedEarlyTasks.clear(); 213 m_queuedEarlyTasks.clear();
214 } 214 }
215 215
216 void WorkerMessagingProxy::workerObjectDestroyed() 216 void WorkerMessagingProxy::workerObjectDestroyed()
217 { 217 {
218 m_workerObject = nullptr; 218 m_workerObject = nullptr;
219 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&workerObjectD estroyedInternal, AllowCrossThreadAccess(this))); 219 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&workerObjectD estroyedInternal, AllowCrossThreadAccess(this)));
220 } 220 }
221 221
222 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work erMessagingProxy* proxy) 222 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work erMessagingProxy* proxy)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 // FIXME: This need to be revisited when we support nested worker one day 300 // FIXME: This need to be revisited when we support nested worker one day
301 ASSERT(m_executionContext->isDocument()); 301 ASSERT(m_executionContext->isDocument());
302 Document* document = toDocument(m_executionContext.get()); 302 Document* document = toDocument(m_executionContext.get());
303 LocalFrame* frame = document->frame(); 303 LocalFrame* frame = document->frame();
304 if (frame) 304 if (frame)
305 frame->console().adoptWorkerMessagesAfterTermination(this); 305 frame->console().adoptWorkerMessagesAfterTermination(this);
306 } 306 }
307 307
308 } // namespace blink 308 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerInspectorProxy.cpp ('k') | Source/core/workers/WorkerThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698