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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 workerGlobalScope(), WaitUntilObserver::Activate, eventID); 103 workerGlobalScope(), WaitUntilObserver::Activate, eventID);
104 Event* event = ExtendableEvent::create(EventTypeNames::activate, 104 Event* event = ExtendableEvent::create(EventTypeNames::activate,
105 ExtendableEventInit(), observer); 105 ExtendableEventInit(), observer);
106 workerGlobalScope()->dispatchExtendableEvent(event, observer); 106 workerGlobalScope()->dispatchExtendableEvent(event, observer);
107 } 107 }
108 108
109 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( 109 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(
110 int eventID, 110 int eventID,
111 const WebString& message, 111 const WebString& message,
112 const WebSecurityOrigin& sourceOrigin, 112 const WebSecurityOrigin& sourceOrigin,
113 const WebMessagePortChannelArray& webChannels, 113 WebMessagePortChannelArray webChannels,
114 const WebServiceWorkerClientInfo& client) { 114 const WebServiceWorkerClientInfo& client) {
115 WebSerializedScriptValue value = 115 WebSerializedScriptValue value =
116 WebSerializedScriptValue::fromString(message); 116 WebSerializedScriptValue::fromString(message);
117 MessagePortArray* ports = 117 MessagePortArray* ports = MessagePort::toMessagePortArray(
118 MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); 118 m_workerGlobalScope, std::move(webChannels));
119 String origin; 119 String origin;
120 if (!sourceOrigin.isUnique()) 120 if (!sourceOrigin.isUnique())
121 origin = sourceOrigin.toString(); 121 origin = sourceOrigin.toString();
122 ServiceWorkerClient* source = nullptr; 122 ServiceWorkerClient* source = nullptr;
123 if (client.clientType == WebServiceWorkerClientTypeWindow) 123 if (client.clientType == WebServiceWorkerClientTypeWindow)
124 source = ServiceWorkerWindowClient::create(client); 124 source = ServiceWorkerWindowClient::create(client);
125 else 125 else
126 source = ServiceWorkerClient::create(client); 126 source = ServiceWorkerClient::create(client);
127 WaitUntilObserver* observer = WaitUntilObserver::create( 127 WaitUntilObserver* observer = WaitUntilObserver::create(
128 workerGlobalScope(), WaitUntilObserver::Message, eventID); 128 workerGlobalScope(), WaitUntilObserver::Message, eventID);
129 129
130 Event* event = 130 Event* event =
131 ExtendableMessageEvent::create(value, origin, ports, source, observer); 131 ExtendableMessageEvent::create(value, origin, ports, source, observer);
132 workerGlobalScope()->dispatchExtendableEvent(event, observer); 132 workerGlobalScope()->dispatchExtendableEvent(event, observer);
133 } 133 }
134 134
135 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent( 135 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(
136 int eventID, 136 int eventID,
137 const WebString& message, 137 const WebString& message,
138 const WebSecurityOrigin& sourceOrigin, 138 const WebSecurityOrigin& sourceOrigin,
139 const WebMessagePortChannelArray& webChannels, 139 WebMessagePortChannelArray webChannels,
140 std::unique_ptr<WebServiceWorker::Handle> handle) { 140 std::unique_ptr<WebServiceWorker::Handle> handle) {
141 WebSerializedScriptValue value = 141 WebSerializedScriptValue value =
142 WebSerializedScriptValue::fromString(message); 142 WebSerializedScriptValue::fromString(message);
143 MessagePortArray* ports = 143 MessagePortArray* ports = MessagePort::toMessagePortArray(
144 MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); 144 m_workerGlobalScope, std::move(webChannels));
145 String origin; 145 String origin;
146 if (!sourceOrigin.isUnique()) 146 if (!sourceOrigin.isUnique())
147 origin = sourceOrigin.toString(); 147 origin = sourceOrigin.toString();
148 ServiceWorker* source = 148 ServiceWorker* source =
149 ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), 149 ServiceWorker::from(m_workerGlobalScope->getExecutionContext(),
150 WTF::wrapUnique(handle.release())); 150 WTF::wrapUnique(handle.release()));
151 WaitUntilObserver* observer = WaitUntilObserver::create( 151 WaitUntilObserver* observer = WaitUntilObserver::create(
152 workerGlobalScope(), WaitUntilObserver::Message, eventID); 152 workerGlobalScope(), WaitUntilObserver::Message, eventID);
153 153
154 Event* event = 154 Event* event =
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return *m_document; 483 return *m_document;
484 } 484 }
485 485
486 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() 486 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope()
487 const { 487 const {
488 DCHECK(m_workerGlobalScope); 488 DCHECK(m_workerGlobalScope);
489 return m_workerGlobalScope; 489 return m_workerGlobalScope;
490 } 490 }
491 491
492 } // namespace blink 492 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | third_party/WebKit/Source/web/WebDOMMessageEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698