Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 314373002: Revert "Push API: define push event on Service Worker." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git cl dcommit Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
40 #include "modules/serviceworkers/FetchEvent.h" 39 #include "modules/serviceworkers/FetchEvent.h"
41 #include "modules/serviceworkers/InstallEvent.h" 40 #include "modules/serviceworkers/InstallEvent.h"
42 #include "modules/serviceworkers/InstallPhaseEvent.h" 41 #include "modules/serviceworkers/InstallPhaseEvent.h"
43 #include "modules/serviceworkers/WaitUntilObserver.h" 42 #include "modules/serviceworkers/WaitUntilObserver.h"
44 #include "platform/NotImplemented.h" 43 #include "platform/NotImplemented.h"
45 #include "public/web/WebSerializedScriptValue.h" 44 #include "public/web/WebSerializedScriptValue.h"
46 #include "public/web/WebServiceWorkerContextClient.h" 45 #include "public/web/WebServiceWorkerContextClient.h"
47 #include "web/WebEmbeddedWorkerImpl.h" 46 #include "web/WebEmbeddedWorkerImpl.h"
48 #include "wtf/Functional.h" 47 #include "wtf/Functional.h"
49 #include "wtf/PassOwnPtr.h" 48 #include "wtf/PassOwnPtr.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 89
91 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels) 90 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels)
92 { 91 {
93 ASSERT(m_workerGlobalScope); 92 ASSERT(m_workerGlobalScope);
94 93
95 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(m_workerGlo balScope, webChannels); 94 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(m_workerGlo balScope, webChannels);
96 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 95 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
97 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val ue)); 96 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val ue));
98 } 97 }
99 98
100 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri ng& data)
101 {
102 ASSERT(m_workerGlobalScope);
103 m_workerGlobalScope->dispatchEvent(PushEvent::create(EventTypeNames::push, d ata));
104 }
105
106 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) 99 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID)
107 { 100 {
108 ASSERT(m_workerGlobalScope); 101 ASSERT(m_workerGlobalScope);
109 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync)); 102 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync));
110 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven t(eventID); 103 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven t(eventID);
111 } 104 }
112 105
113 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) 106 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
114 { 107 {
115 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); 108 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 148
156 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC lient& client) 149 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC lient& client)
157 : m_embeddedWorker(embeddedWorker) 150 : m_embeddedWorker(embeddedWorker)
158 , m_executionContext(executionContext) 151 , m_executionContext(executionContext)
159 , m_client(client) 152 , m_client(client)
160 , m_workerGlobalScope(0) 153 , m_workerGlobalScope(0)
161 { 154 {
162 } 155 }
163 156
164 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698