| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 workerGlobalScope(), WaitUntilObserver::Activate, eventID); | 103 workerGlobalScope(), WaitUntilObserver::Activate, eventID); |
| 104 Event* event = ExtendableEvent::create(EventTypeNames::activate, | 104 Event* event = ExtendableEvent::create(EventTypeNames::activate, |
| 105 ExtendableEventInit(), observer); | 105 ExtendableEventInit(), observer); |
| 106 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 106 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( | 109 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( |
| 110 int eventID, | 110 int eventID, |
| 111 const WebString& message, | 111 const WebString& message, |
| 112 const WebSecurityOrigin& sourceOrigin, | 112 const WebSecurityOrigin& sourceOrigin, |
| 113 const WebMessagePortChannelArray& webChannels, | 113 WebMessagePortChannelArray webChannels, |
| 114 const WebServiceWorkerClientInfo& client) { | 114 const WebServiceWorkerClientInfo& client) { |
| 115 WebSerializedScriptValue value = | 115 WebSerializedScriptValue value = |
| 116 WebSerializedScriptValue::fromString(message); | 116 WebSerializedScriptValue::fromString(message); |
| 117 MessagePortArray* ports = | 117 MessagePortArray* ports = MessagePort::toMessagePortArray( |
| 118 MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); | 118 m_workerGlobalScope, std::move(webChannels)); |
| 119 String origin; | 119 String origin; |
| 120 if (!sourceOrigin.isUnique()) | 120 if (!sourceOrigin.isUnique()) |
| 121 origin = sourceOrigin.toString(); | 121 origin = sourceOrigin.toString(); |
| 122 ServiceWorkerClient* source = nullptr; | 122 ServiceWorkerClient* source = nullptr; |
| 123 if (client.clientType == WebServiceWorkerClientTypeWindow) | 123 if (client.clientType == WebServiceWorkerClientTypeWindow) |
| 124 source = ServiceWorkerWindowClient::create(client); | 124 source = ServiceWorkerWindowClient::create(client); |
| 125 else | 125 else |
| 126 source = ServiceWorkerClient::create(client); | 126 source = ServiceWorkerClient::create(client); |
| 127 WaitUntilObserver* observer = WaitUntilObserver::create( | 127 WaitUntilObserver* observer = WaitUntilObserver::create( |
| 128 workerGlobalScope(), WaitUntilObserver::Message, eventID); | 128 workerGlobalScope(), WaitUntilObserver::Message, eventID); |
| 129 | 129 |
| 130 Event* event = | 130 Event* event = |
| 131 ExtendableMessageEvent::create(value, origin, ports, source, observer); | 131 ExtendableMessageEvent::create(value, origin, ports, source, observer); |
| 132 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 132 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( | 135 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( |
| 136 int eventID, | 136 int eventID, |
| 137 const WebString& message, | 137 const WebString& message, |
| 138 const WebSecurityOrigin& sourceOrigin, | 138 const WebSecurityOrigin& sourceOrigin, |
| 139 const WebMessagePortChannelArray& webChannels, | 139 WebMessagePortChannelArray webChannels, |
| 140 std::unique_ptr<WebServiceWorker::Handle> handle) { | 140 std::unique_ptr<WebServiceWorker::Handle> handle) { |
| 141 WebSerializedScriptValue value = | 141 WebSerializedScriptValue value = |
| 142 WebSerializedScriptValue::fromString(message); | 142 WebSerializedScriptValue::fromString(message); |
| 143 MessagePortArray* ports = | 143 MessagePortArray* ports = MessagePort::toMessagePortArray( |
| 144 MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); | 144 m_workerGlobalScope, std::move(webChannels)); |
| 145 String origin; | 145 String origin; |
| 146 if (!sourceOrigin.isUnique()) | 146 if (!sourceOrigin.isUnique()) |
| 147 origin = sourceOrigin.toString(); | 147 origin = sourceOrigin.toString(); |
| 148 ServiceWorker* source = | 148 ServiceWorker* source = |
| 149 ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), | 149 ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), |
| 150 WTF::wrapUnique(handle.release())); | 150 WTF::wrapUnique(handle.release())); |
| 151 WaitUntilObserver* observer = WaitUntilObserver::create( | 151 WaitUntilObserver* observer = WaitUntilObserver::create( |
| 152 workerGlobalScope(), WaitUntilObserver::Message, eventID); | 152 workerGlobalScope(), WaitUntilObserver::Message, eventID); |
| 153 | 153 |
| 154 Event* event = | 154 Event* event = |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return *m_document; | 483 return *m_document; |
| 484 } | 484 } |
| 485 | 485 |
| 486 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() | 486 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() |
| 487 const { | 487 const { |
| 488 DCHECK(m_workerGlobalScope); | 488 DCHECK(m_workerGlobalScope); |
| 489 return m_workerGlobalScope; | 489 return m_workerGlobalScope; |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace blink | 492 } // namespace blink |
| OLD | NEW |