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

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

Issue 1008533005: Initial implementation of stashed message ports, blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextClient.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" 47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h"
48 #include "modules/notifications/Notification.h" 48 #include "modules/notifications/Notification.h"
49 #include "modules/notifications/NotificationEvent.h" 49 #include "modules/notifications/NotificationEvent.h"
50 #include "modules/push_messaging/PushEvent.h" 50 #include "modules/push_messaging/PushEvent.h"
51 #include "modules/push_messaging/PushMessageData.h" 51 #include "modules/push_messaging/PushMessageData.h"
52 #include "modules/serviceworkers/ExtendableEvent.h" 52 #include "modules/serviceworkers/ExtendableEvent.h"
53 #include "modules/serviceworkers/FetchEvent.h" 53 #include "modules/serviceworkers/FetchEvent.h"
54 #include "modules/serviceworkers/ServiceWorkerClient.h" 54 #include "modules/serviceworkers/ServiceWorkerClient.h"
55 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 55 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
56 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" 56 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
57 #include "modules/serviceworkers/StashedMessagePort.h"
58 #include "modules/serviceworkers/StashedPortCollection.h"
57 #include "modules/serviceworkers/WaitUntilObserver.h" 59 #include "modules/serviceworkers/WaitUntilObserver.h"
58 #include "platform/RuntimeEnabledFeatures.h" 60 #include "platform/RuntimeEnabledFeatures.h"
59 #include "public/platform/WebCrossOriginServiceWorkerClient.h" 61 #include "public/platform/WebCrossOriginServiceWorkerClient.h"
60 #include "public/platform/WebServiceWorkerEventResult.h" 62 #include "public/platform/WebServiceWorkerEventResult.h"
61 #include "public/platform/WebServiceWorkerRequest.h" 63 #include "public/platform/WebServiceWorkerRequest.h"
62 #include "public/platform/modules/notifications/WebNotificationData.h" 64 #include "public/platform/modules/notifications/WebNotificationData.h"
63 #include "public/web/WebSerializedScriptValue.h" 65 #include "public/web/WebSerializedScriptValue.h"
64 #include "public/web/WebServiceWorkerContextClient.h" 66 #include "public/web/WebServiceWorkerContextClient.h"
65 #include "web/WebEmbeddedWorkerImpl.h" 67 #include "web/WebEmbeddedWorkerImpl.h"
66 #include "wtf/Functional.h" 68 #include "wtf/Functional.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 { 181 {
180 ASSERT(m_workerGlobalScope); 182 ASSERT(m_workerGlobalScope);
181 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray (m_workerGlobalScope, webChannels); 183 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray (m_workerGlobalScope, webChannels);
182 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 184 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
183 // FIXME: Have proper source for this MessageEvent. 185 // FIXME: Have proper source for this MessageEvent.
184 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports.release( ), value, webClient.origin.string()); 186 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports.release( ), value, webClient.origin.string());
185 event->setType(EventTypeNames::crossoriginmessage); 187 event->setType(EventTypeNames::crossoriginmessage);
186 m_workerGlobalScope->dispatchEvent(event); 188 m_workerGlobalScope->dispatchEvent(event);
187 } 189 }
188 190
191 void ServiceWorkerGlobalScopeProxy::addStashedMessagePorts(const WebMessagePortC hannelArray& webChannels, const WebVector<WebString>& webChannelNames)
192 {
193 ASSERT(m_workerGlobalScope);
194 OwnPtrWillBeRawPtr<StashedMessagePortArray> ports = StashedMessagePort::toSt ashedMessagePortArray(m_workerGlobalScope, webChannels, webChannelNames);
195 m_workerGlobalScope->ports()->addPorts(*ports);
196 }
197
189 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int) 198 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int)
190 { 199 {
191 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); 200 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);
192 } 201 }
193 202
194 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr< ConsoleMessage> consoleMessage) 203 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr< ConsoleMessage> consoleMessage)
195 { 204 {
196 m_client.reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l()); 205 m_client.reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l());
197 } 206 }
198 207
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 240
232 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 241 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
233 : m_embeddedWorker(embeddedWorker) 242 : m_embeddedWorker(embeddedWorker)
234 , m_document(document) 243 , m_document(document)
235 , m_client(client) 244 , m_client(client)
236 , m_workerGlobalScope(0) 245 , m_workerGlobalScope(0)
237 { 246 {
238 } 247 }
239 248
240 } // namespace blink 249 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698