| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 if (shouldNotifyControllerChange) | 391 if (shouldNotifyControllerChange) |
| 392 dispatchEvent(Event::create(EventTypeNames::controllerchange)); | 392 dispatchEvent(Event::create(EventTypeNames::controllerchange)); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void ServiceWorkerContainer::dispatchMessageEvent(std::unique_ptr<WebServiceWork
er::Handle> handle, const WebString& message, const WebMessagePortChannelArray&
webChannels) | 395 void ServiceWorkerContainer::dispatchMessageEvent(std::unique_ptr<WebServiceWork
er::Handle> handle, const WebString& message, const WebMessagePortChannelArray&
webChannels) |
| 396 { | 396 { |
| 397 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) | 397 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) |
| 398 return; | 398 return; |
| 399 | 399 |
| 400 MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContex
t(), webChannels); | 400 MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContex
t(), webChannels); |
| 401 RefPtr<SerializedScriptValue> value = SerializedScriptValueFactory::instance
().createFromWire(message); | 401 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message)
; |
| 402 ServiceWorker* source = ServiceWorker::from(getExecutionContext(), adoptPtr(
handle.release())); | 402 ServiceWorker* source = ServiceWorker::from(getExecutionContext(), adoptPtr(
handle.release())); |
| 403 dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExe
cutionContext()->getSecurityOrigin()->toString())); | 403 dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExe
cutionContext()->getSecurityOrigin()->toString())); |
| 404 } | 404 } |
| 405 | 405 |
| 406 const AtomicString& ServiceWorkerContainer::interfaceName() const | 406 const AtomicString& ServiceWorkerContainer::interfaceName() const |
| 407 { | 407 { |
| 408 return EventTargetNames::ServiceWorkerContainer; | 408 return EventTargetNames::ServiceWorkerContainer; |
| 409 } | 409 } |
| 410 | 410 |
| 411 ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContex
t) | 411 ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContex
t) |
| 412 : ContextLifecycleObserver(executionContext) | 412 : ContextLifecycleObserver(executionContext) |
| 413 , m_provider(0) | 413 , m_provider(0) |
| 414 { | 414 { |
| 415 | 415 |
| 416 if (!executionContext) | 416 if (!executionContext) |
| 417 return; | 417 return; |
| 418 | 418 |
| 419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 419 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
| 420 m_provider = client->provider(); | 420 m_provider = client->provider(); |
| 421 if (m_provider) | 421 if (m_provider) |
| 422 m_provider->setClient(this); | 422 m_provider->setClient(this); |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace blink | 426 } // namespace blink |
| OLD | NEW |