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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 { | 99 { |
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 ExtendableMessageEventInit initializer; | 109 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 110 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(m_workerGlobalScope, webChannels); |
| 111 // TODO(nhiroki): Support |origin| and |source| attributes. |
| 112 // (http://crbug.com/543198) |
| 113 |
110 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); | 114 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Message, eventID); |
111 | 115 |
112 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(EventTypeName
s::message, initializer, observer)); | 116 RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, String
(), ports, observer)); |
113 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 117 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
114 } | 118 } |
115 | 119 |
116 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 120 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
117 { | 121 { |
118 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::fetch); | 122 dispatchFetchEventImpl(eventID, webRequest, EventTypeNames::fetch); |
119 } | 123 } |
120 | 124 |
121 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) | 125 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) |
122 { | 126 { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 eventInit.setCancelable(true); | 304 eventInit.setCancelable(true); |
301 eventInit.setRequest(request); | 305 eventInit.setRequest(request); |
302 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 306 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
303 eventInit.setIsReload(webRequest.isReload()); | 307 eventInit.setIsReload(webRequest.isReload()); |
304 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 308 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); |
305 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; | 309 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; |
306 observer->didDispatchEvent(defaultPrevented); | 310 observer->didDispatchEvent(defaultPrevented); |
307 } | 311 } |
308 | 312 |
309 } // namespace blink | 313 } // namespace blink |
OLD | NEW |