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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) | 72 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) |
73 { | 73 { |
74 ASSERT(m_workerGlobalScope); | 74 ASSERT(m_workerGlobalScope); |
75 RefPtr<WaitUntilObserver> observer = WaitUntilObserver::create(m_workerGloba
lScope, WaitUntilObserver::Activate, eventID); | 75 RefPtr<WaitUntilObserver> observer = WaitUntilObserver::create(m_workerGloba
lScope, WaitUntilObserver::Activate, eventID); |
76 observer->willDispatchEvent(); | 76 observer->willDispatchEvent(); |
77 m_workerGlobalScope->dispatchEvent(InstallPhaseEvent::create(EventTypeNames:
:activate, EventInit(), observer)); | 77 m_workerGlobalScope->dispatchEvent(InstallPhaseEvent::create(EventTypeNames:
:activate, EventInit(), observer)); |
78 observer->didDispatchEvent(); | 78 observer->didDispatchEvent(); |
79 } | 79 } |
80 | 80 |
| 81 // TODO(horo): Remove this. |
81 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID) | 82 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID) |
82 { | 83 { |
83 ASSERT(m_workerGlobalScope); | 84 ASSERT(m_workerGlobalScope); |
84 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG
lobalScope, eventID); | 85 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG
lobalScope, eventID); |
85 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer)); | 86 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer)); |
86 observer->didDispatchEvent(); | 87 observer->didDispatchEvent(); |
87 } | 88 } |
88 | 89 |
| 90 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
| 91 { |
| 92 ASSERT(m_workerGlobalScope); |
| 93 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG
lobalScope, eventID); |
| 94 RefPtr<Request> request = Request::create(webRequest); |
| 95 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer, request)); |
| 96 observer->didDispatchEvent(); |
| 97 } |
| 98 |
89 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) | 99 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) |
90 { | 100 { |
91 ASSERT(m_workerGlobalScope); | 101 ASSERT(m_workerGlobalScope); |
92 | 102 |
93 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(m_workerGlo
balScope, webChannels); | 103 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(m_workerGlo
balScope, webChannels); |
94 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 104 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
95 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); | 105 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); |
96 } | 106 } |
97 | 107 |
98 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) | 108 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 157 |
148 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) | 158 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) |
149 : m_embeddedWorker(embeddedWorker) | 159 : m_embeddedWorker(embeddedWorker) |
150 , m_executionContext(executionContext) | 160 , m_executionContext(executionContext) |
151 , m_client(client) | 161 , m_client(client) |
152 , m_workerGlobalScope(0) | 162 , m_workerGlobalScope(0) |
153 { | 163 { |
154 } | 164 } |
155 | 165 |
156 } // namespace blink | 166 } // namespace blink |
OLD | NEW |