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

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: address comments 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "modules/navigatorconnect/AcceptConnectionObserver.h" 45 #include "modules/navigatorconnect/AcceptConnectionObserver.h"
46 #include "modules/navigatorconnect/CrossOriginConnectEvent.h" 46 #include "modules/navigatorconnect/CrossOriginConnectEvent.h"
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/ServiceWorkerGlobalScope.h" 54 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
55 #include "modules/serviceworkers/StashedMessagePort.h"
56 #include "modules/serviceworkers/StashedPortCollection.h"
55 #include "modules/serviceworkers/WaitUntilObserver.h" 57 #include "modules/serviceworkers/WaitUntilObserver.h"
56 #include "platform/RuntimeEnabledFeatures.h" 58 #include "platform/RuntimeEnabledFeatures.h"
57 #include "public/platform/WebCrossOriginServiceWorkerClient.h" 59 #include "public/platform/WebCrossOriginServiceWorkerClient.h"
58 #include "public/platform/WebServiceWorkerEventResult.h" 60 #include "public/platform/WebServiceWorkerEventResult.h"
59 #include "public/platform/WebServiceWorkerRequest.h" 61 #include "public/platform/WebServiceWorkerRequest.h"
60 #include "public/platform/modules/notifications/WebNotificationData.h" 62 #include "public/platform/modules/notifications/WebNotificationData.h"
61 #include "public/web/WebSerializedScriptValue.h" 63 #include "public/web/WebSerializedScriptValue.h"
62 #include "public/web/WebServiceWorkerContextClient.h" 64 #include "public/web/WebServiceWorkerContextClient.h"
63 #include "web/WebEmbeddedWorkerImpl.h" 65 #include "web/WebEmbeddedWorkerImpl.h"
64 #include "wtf/Functional.h" 66 #include "wtf/Functional.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 { 174 {
173 ASSERT(m_workerGlobalScope); 175 ASSERT(m_workerGlobalScope);
174 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray (m_workerGlobalScope, webChannels); 176 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray (m_workerGlobalScope, webChannels);
175 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 177 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
176 // FIXME: Have proper source for this MessageEvent. 178 // FIXME: Have proper source for this MessageEvent.
177 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports.release( ), value, webClient.origin.string()); 179 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports.release( ), value, webClient.origin.string());
178 event->setType(EventTypeNames::crossoriginmessage); 180 event->setType(EventTypeNames::crossoriginmessage);
179 m_workerGlobalScope->dispatchEvent(event); 181 m_workerGlobalScope->dispatchEvent(event);
180 } 182 }
181 183
184 void ServiceWorkerGlobalScopeProxy::addStashedMessagePorts(const WebMessagePortC hannelArray& webChannels, const WebVector<WebString>& webChannelNames)
185 {
186 ASSERT(m_workerGlobalScope);
187 OwnPtrWillBeRawPtr<StashedMessagePortArray> ports = StashedMessagePort::toSt ashedMessagePortArray(m_workerGlobalScope, webChannels, webChannelNames);
188 m_workerGlobalScope->ports()->addPorts(*ports);
189 }
190
182 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int) 191 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int)
183 { 192 {
184 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); 193 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);
185 } 194 }
186 195
187 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr< ConsoleMessage> consoleMessage) 196 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr< ConsoleMessage> consoleMessage)
188 { 197 {
189 m_client.reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l()); 198 m_client.reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l());
190 } 199 }
191 200
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 233
225 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 234 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
226 : m_embeddedWorker(embeddedWorker) 235 : m_embeddedWorker(embeddedWorker)
227 , m_document(document) 236 , m_document(document)
228 , m_client(client) 237 , m_client(client)
229 , m_workerGlobalScope(0) 238 , m_workerGlobalScope(0)
230 { 239 {
231 } 240 }
232 241
233 } // namespace blink 242 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698