| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Activate, eventID); | 100 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Activate, eventID); |
| 101 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); | 101 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); |
| 102 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 102 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebMessagePortChannelArray& webChannels) | 105 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID,
const WebString& message, const WebMessagePortChannelArray& webChannels) |
| 106 { | 106 { |
| 107 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; | 107 ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled())
; |
| 108 | 108 |
| 109 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 109 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 110 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(m_workerGlobalScope, webChannels); | 110 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); |
| 111 // TODO(nhiroki): Support |origin| and |source| attributes. | 111 // TODO(nhiroki): Support |origin| and |source| attributes. |
| 112 // (http://crbug.com/543198) | 112 // (http://crbug.com/543198) |
| 113 | 113 |
| 114 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); | 114 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); |
| 115 | 115 |
| 116 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, String
(), ports, observer)); | 116 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, String
(), ports, observer)); |
| 117 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 117 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 120 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 eventInit.setCancelable(true); | 304 eventInit.setCancelable(true); |
| 305 eventInit.setRequest(request); | 305 eventInit.setRequest(request); |
| 306 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 306 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
| 307 eventInit.setIsReload(webRequest.isReload()); | 307 eventInit.setIsReload(webRequest.isReload()); |
| 308 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 308 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); |
| 309 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; | 309 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; |
| 310 observer->didDispatchEvent(defaultPrevented); | 310 observer->didDispatchEvent(defaultPrevented); |
| 311 } | 311 } |
| 312 | 312 |
| 313 } // namespace blink | 313 } // namespace blink |
| OLD | NEW |