| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 ParentFrameTaskRunners* parentFrameTaskRunners) { | 58 ParentFrameTaskRunners* parentFrameTaskRunners) { |
| 59 DCHECK(messagingProxyWeakPtr); | 59 DCHECK(messagingProxyWeakPtr); |
| 60 return WTF::wrapUnique(new InProcessWorkerObjectProxy( | 60 return WTF::wrapUnique(new InProcessWorkerObjectProxy( |
| 61 messagingProxyWeakPtr, parentFrameTaskRunners)); | 61 messagingProxyWeakPtr, parentFrameTaskRunners)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {} | 64 InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {} |
| 65 | 65 |
| 66 void InProcessWorkerObjectProxy::postMessageToWorkerObject( | 66 void InProcessWorkerObjectProxy::postMessageToWorkerObject( |
| 67 PassRefPtr<SerializedScriptValue> message, | 67 PassRefPtr<SerializedScriptValue> message, |
| 68 std::unique_ptr<MessagePortChannelArray> channels) { | 68 MessagePortChannelArray channels) { |
| 69 getParentFrameTaskRunners() | 69 getParentFrameTaskRunners() |
| 70 ->get(TaskType::PostedMessage) | 70 ->get(TaskType::PostedMessage) |
| 71 ->postTask(BLINK_FROM_HERE, | 71 ->postTask(BLINK_FROM_HERE, |
| 72 crossThreadBind( | 72 crossThreadBind( |
| 73 &InProcessWorkerMessagingProxy::postMessageToWorkerObject, | 73 &InProcessWorkerMessagingProxy::postMessageToWorkerObject, |
| 74 m_messagingProxyWeakPtr, std::move(message), | 74 m_messagingProxyWeakPtr, std::move(message), |
| 75 WTF::passed(std::move(channels)))); | 75 WTF::passed(std::move(channels)))); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void InProcessWorkerObjectProxy::processMessageFromWorkerObject( | 78 void InProcessWorkerObjectProxy::processMessageFromWorkerObject( |
| 79 PassRefPtr<SerializedScriptValue> message, | 79 PassRefPtr<SerializedScriptValue> message, |
| 80 std::unique_ptr<MessagePortChannelArray> channels, | 80 MessagePortChannelArray channels, |
| 81 WorkerThread* workerThread) { | 81 WorkerThread* workerThread) { |
| 82 WorkerGlobalScope* globalScope = | 82 WorkerGlobalScope* globalScope = |
| 83 toWorkerGlobalScope(workerThread->globalScope()); | 83 toWorkerGlobalScope(workerThread->globalScope()); |
| 84 MessagePortArray* ports = | 84 MessagePortArray* ports = |
| 85 MessagePort::entanglePorts(*globalScope, std::move(channels)); | 85 MessagePort::entanglePorts(*globalScope, std::move(channels)); |
| 86 globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message))); | 86 globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message))); |
| 87 | 87 |
| 88 getParentFrameTaskRunners() | 88 getParentFrameTaskRunners() |
| 89 ->get(TaskType::UnspecedTimer) | 89 ->get(TaskType::UnspecedTimer) |
| 90 ->postTask( | 90 ->postTask( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // There is still a pending activity. Check it later. | 177 // There is still a pending activity. Check it later. |
| 178 startPendingActivityTimer(); | 178 startPendingActivityTimer(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 WeakPtr<ThreadedMessagingProxyBase> | 181 WeakPtr<ThreadedMessagingProxyBase> |
| 182 InProcessWorkerObjectProxy::messagingProxyWeakPtr() { | 182 InProcessWorkerObjectProxy::messagingProxyWeakPtr() { |
| 183 return m_messagingProxyWeakPtr; | 183 return m_messagingProxyWeakPtr; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |