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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "web/ServiceWorkerGlobalScopeProxy.h" | 32 #include "web/ServiceWorkerGlobalScopeProxy.h" |
33 | 33 |
34 #include "bindings/v8/WorkerScriptController.h" | 34 #include "bindings/v8/WorkerScriptController.h" |
35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
36 #include "core/dom/MessagePort.h" | 36 #include "core/dom/MessagePort.h" |
37 #include "core/events/MessageEvent.h" | 37 #include "core/events/MessageEvent.h" |
38 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
| 39 #include "modules/push_messaging/PushEvent.h" |
39 #include "modules/serviceworkers/FetchEvent.h" | 40 #include "modules/serviceworkers/FetchEvent.h" |
40 #include "modules/serviceworkers/InstallEvent.h" | 41 #include "modules/serviceworkers/InstallEvent.h" |
41 #include "modules/serviceworkers/InstallPhaseEvent.h" | 42 #include "modules/serviceworkers/InstallPhaseEvent.h" |
42 #include "modules/serviceworkers/WaitUntilObserver.h" | 43 #include "modules/serviceworkers/WaitUntilObserver.h" |
43 #include "platform/NotImplemented.h" | 44 #include "platform/NotImplemented.h" |
44 #include "public/web/WebSerializedScriptValue.h" | 45 #include "public/web/WebSerializedScriptValue.h" |
45 #include "public/web/WebServiceWorkerContextClient.h" | 46 #include "public/web/WebServiceWorkerContextClient.h" |
46 #include "web/WebEmbeddedWorkerImpl.h" | 47 #include "web/WebEmbeddedWorkerImpl.h" |
47 #include "wtf/Functional.h" | 48 #include "wtf/Functional.h" |
48 #include "wtf/PassOwnPtr.h" | 49 #include "wtf/PassOwnPtr.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); | 96 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); |
96 } | 97 } |
97 | 98 |
98 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) | 99 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) |
99 { | 100 { |
100 ASSERT(m_workerGlobalScope); | 101 ASSERT(m_workerGlobalScope); |
101 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync)); | 102 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync)); |
102 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven
t(eventID); | 103 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven
t(eventID); |
103 } | 104 } |
104 | 105 |
| 106 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
| 107 { |
| 108 ASSERT(m_workerGlobalScope); |
| 109 m_workerGlobalScope->dispatchEvent(PushEvent::create(EventTypeNames::push, d
ata)); |
| 110 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandlePushEven
t(eventID); |
| 111 } |
| 112 |
105 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL) | 113 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL) |
106 { | 114 { |
107 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); | 115 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); |
108 } | 116 } |
109 | 117 |
110 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource source, M
essageLevel level, const String& message, int lineNumber, const String& sourceUR
L) | 118 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource source, M
essageLevel level, const String& message, int lineNumber, const String& sourceUR
L) |
111 { | 119 { |
112 m_client.reportConsoleMessage(source, level, message, lineNumber, sourceURL)
; | 120 m_client.reportConsoleMessage(source, level, message, lineNumber, sourceURL)
; |
113 } | 121 } |
114 | 122 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 155 |
148 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) | 156 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) |
149 : m_embeddedWorker(embeddedWorker) | 157 : m_embeddedWorker(embeddedWorker) |
150 , m_executionContext(executionContext) | 158 , m_executionContext(executionContext) |
151 , m_client(client) | 159 , m_client(client) |
152 , m_workerGlobalScope(0) | 160 , m_workerGlobalScope(0) |
153 { | 161 { |
154 } | 162 } |
155 | 163 |
156 } // namespace blink | 164 } // namespace blink |
OLD | NEW |