OLD | NEW |
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 // Worker initialization means a pending activity. | 197 // Worker initialization means a pending activity. |
198 worker_global_scope_has_pending_activity_ = true; | 198 worker_global_scope_has_pending_activity_ = true; |
199 | 199 |
200 DCHECK_EQ(0u, unconfirmed_message_count_); | 200 DCHECK_EQ(0u, unconfirmed_message_count_); |
201 unconfirmed_message_count_ = queued_early_tasks_.size(); | 201 unconfirmed_message_count_ = queued_early_tasks_.size(); |
202 for (auto& queued_task : queued_early_tasks_) { | 202 for (auto& queued_task : queued_early_tasks_) { |
203 std::unique_ptr<WTF::CrossThreadClosure> task = CrossThreadBind( | 203 std::unique_ptr<WTF::CrossThreadClosure> task = CrossThreadBind( |
204 &InProcessWorkerObjectProxy::ProcessMessageFromWorkerObject, | 204 &InProcessWorkerObjectProxy::ProcessMessageFromWorkerObject, |
205 CrossThreadUnretained(&WorkerObjectProxy()), | 205 CrossThreadUnretained(&WorkerObjectProxy()), |
206 queued_task.message.Release(), | 206 std::move(queued_task.message), |
207 WTF::Passed(std::move(queued_task.channels)), | 207 WTF::Passed(std::move(queued_task.channels)), |
208 CrossThreadUnretained(GetWorkerThread())); | 208 CrossThreadUnretained(GetWorkerThread())); |
209 TaskRunnerHelper::Get(TaskType::kPostedMessage, GetWorkerThread()) | 209 TaskRunnerHelper::Get(TaskType::kPostedMessage, GetWorkerThread()) |
210 ->PostTask(BLINK_FROM_HERE, std::move(task)); | 210 ->PostTask(BLINK_FROM_HERE, std::move(task)); |
211 } | 211 } |
212 queued_early_tasks_.clear(); | 212 queued_early_tasks_.clear(); |
213 } | 213 } |
214 | 214 |
215 void InProcessWorkerMessagingProxy::ParentObjectDestroyed() { | 215 void InProcessWorkerMessagingProxy::ParentObjectDestroyed() { |
216 DCHECK(IsParentContextThread()); | 216 DCHECK(IsParentContextThread()); |
(...skipping 27 matching lines...) Expand all Loading... |
244 } | 244 } |
245 | 245 |
246 bool InProcessWorkerMessagingProxy::HasPendingActivity() const { | 246 bool InProcessWorkerMessagingProxy::HasPendingActivity() const { |
247 DCHECK(IsParentContextThread()); | 247 DCHECK(IsParentContextThread()); |
248 if (AskedToTerminate()) | 248 if (AskedToTerminate()) |
249 return false; | 249 return false; |
250 return worker_global_scope_has_pending_activity_; | 250 return worker_global_scope_has_pending_activity_; |
251 } | 251 } |
252 | 252 |
253 } // namespace blink | 253 } // namespace blink |
OLD | NEW |