| 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 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/ScriptState.h" | 35 #include "bindings/core/v8/ScriptState.h" |
| 36 #include "bindings/core/v8/SerializedScriptValue.h" | 36 #include "bindings/core/v8/SerializedScriptValue.h" |
| 37 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 37 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 38 #include "bindings/core/v8/V8ThrowException.h" | 38 #include "bindings/core/v8/V8ThrowException.h" |
| 39 #include "core/dom/DOMException.h" | 39 #include "core/dom/DOMException.h" |
| 40 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 41 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
| 42 #include "core/dom/ExecutionContext.h" | 42 #include "core/dom/ExecutionContext.h" |
| 43 #include "core/dom/MessagePort.h" | 43 #include "core/dom/MessagePort.h" |
| 44 #include "core/events/MessageEvent.h" | 44 #include "core/events/MessageEvent.h" |
| 45 #include "core/frame/Deprecation.h" |
| 45 #include "core/frame/LocalDOMWindow.h" | 46 #include "core/frame/LocalDOMWindow.h" |
| 46 #include "core/frame/UseCounter.h" | 47 #include "core/frame/UseCounter.h" |
| 47 #include "core/frame/csp/ContentSecurityPolicy.h" | 48 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 48 #include "modules/EventTargetModules.h" | 49 #include "modules/EventTargetModules.h" |
| 49 #include "modules/serviceworkers/NavigatorServiceWorker.h" | 50 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
| 50 #include "modules/serviceworkers/ServiceWorker.h" | 51 #include "modules/serviceworkers/ServiceWorker.h" |
| 51 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 52 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
| 52 #include "modules/serviceworkers/ServiceWorkerError.h" | 53 #include "modules/serviceworkers/ServiceWorkerError.h" |
| 53 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 54 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
| 54 #include "platform/RuntimeEnabledFeatures.h" | 55 #include "platform/RuntimeEnabledFeatures.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 MessagePortArray* ports = | 452 MessagePortArray* ports = |
| 452 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); | 453 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); |
| 453 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); | 454 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); |
| 454 ServiceWorker* source = ServiceWorker::from( | 455 ServiceWorker* source = ServiceWorker::from( |
| 455 getExecutionContext(), WTF::wrapUnique(handle.release())); | 456 getExecutionContext(), WTF::wrapUnique(handle.release())); |
| 456 dispatchEvent(MessageEvent::create( | 457 dispatchEvent(MessageEvent::create( |
| 457 ports, value, getExecutionContext()->getSecurityOrigin()->toString(), | 458 ports, value, getExecutionContext()->getSecurityOrigin()->toString(), |
| 458 String() /* lastEventId */, source, String() /* suborigin */)); | 459 String() /* lastEventId */, source, String() /* suborigin */)); |
| 459 } | 460 } |
| 460 | 461 |
| 462 void ServiceWorkerContainer::countFeature(uint32_t feature) { |
| 463 if (!getExecutionContext()) |
| 464 return; |
| 465 UseCounter::Feature useCounterFeature = |
| 466 static_cast<UseCounter::Feature>(feature); |
| 467 if (Deprecation::deprecationMessage(useCounterFeature).isEmpty()) |
| 468 UseCounter::count(getExecutionContext(), useCounterFeature); |
| 469 else |
| 470 Deprecation::countDeprecation(getExecutionContext(), useCounterFeature); |
| 471 } |
| 472 |
| 461 const AtomicString& ServiceWorkerContainer::interfaceName() const { | 473 const AtomicString& ServiceWorkerContainer::interfaceName() const { |
| 462 return EventTargetNames::ServiceWorkerContainer; | 474 return EventTargetNames::ServiceWorkerContainer; |
| 463 } | 475 } |
| 464 | 476 |
| 465 ServiceWorkerContainer::ServiceWorkerContainer( | 477 ServiceWorkerContainer::ServiceWorkerContainer( |
| 466 ExecutionContext* executionContext, | 478 ExecutionContext* executionContext, |
| 467 NavigatorServiceWorker* navigator) | 479 NavigatorServiceWorker* navigator) |
| 468 : ContextLifecycleObserver(executionContext), | 480 : ContextLifecycleObserver(executionContext), |
| 469 m_provider(0), | 481 m_provider(0), |
| 470 m_navigator(navigator) { | 482 m_navigator(navigator) { |
| 471 if (!executionContext) | 483 if (!executionContext) |
| 472 return; | 484 return; |
| 473 | 485 |
| 474 if (ServiceWorkerContainerClient* client = | 486 if (ServiceWorkerContainerClient* client = |
| 475 ServiceWorkerContainerClient::from(executionContext)) { | 487 ServiceWorkerContainerClient::from(executionContext)) { |
| 476 m_provider = client->provider(); | 488 m_provider = client->provider(); |
| 477 if (m_provider) | 489 if (m_provider) |
| 478 m_provider->setClient(this); | 490 m_provider->setClient(this); |
| 479 } | 491 } |
| 480 } | 492 } |
| 481 | 493 |
| 482 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |