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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 if (m_controller) 438 if (m_controller)
439 UseCounter::count(getExecutionContext(), 439 UseCounter::count(getExecutionContext(),
440 UseCounter::ServiceWorkerControlledPage); 440 UseCounter::ServiceWorkerControlledPage);
441 if (shouldNotifyControllerChange) 441 if (shouldNotifyControllerChange)
442 dispatchEvent(Event::create(EventTypeNames::controllerchange)); 442 dispatchEvent(Event::create(EventTypeNames::controllerchange));
443 } 443 }
444 444
445 void ServiceWorkerContainer::dispatchMessageEvent( 445 void ServiceWorkerContainer::dispatchMessageEvent(
446 std::unique_ptr<WebServiceWorker::Handle> handle, 446 std::unique_ptr<WebServiceWorker::Handle> handle,
447 const WebString& message, 447 const WebString& message,
448 const WebMessagePortChannelArray& webChannels) { 448 WebMessagePortChannelArray webChannels) {
449 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) 449 if (!getExecutionContext() || !getExecutionContext()->executingWindow())
450 return; 450 return;
451 451
452 MessagePortArray* ports = 452 MessagePortArray* ports = MessagePort::toMessagePortArray(
453 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); 453 getExecutionContext(), std::move(webChannels));
454 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); 454 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message);
455 ServiceWorker* source = ServiceWorker::from( 455 ServiceWorker* source = ServiceWorker::from(
456 getExecutionContext(), WTF::wrapUnique(handle.release())); 456 getExecutionContext(), WTF::wrapUnique(handle.release()));
457 dispatchEvent(MessageEvent::create( 457 dispatchEvent(MessageEvent::create(
458 ports, value, getExecutionContext()->getSecurityOrigin()->toString(), 458 ports, value, getExecutionContext()->getSecurityOrigin()->toString(),
459 String() /* lastEventId */, source, String() /* suborigin */)); 459 String() /* lastEventId */, source, String() /* suborigin */));
460 } 460 }
461 461
462 void ServiceWorkerContainer::countFeature(uint32_t feature) { 462 void ServiceWorkerContainer::countFeature(uint32_t feature) {
463 if (!getExecutionContext()) 463 if (!getExecutionContext())
(...skipping 21 matching lines...) Expand all
485 485
486 if (ServiceWorkerContainerClient* client = 486 if (ServiceWorkerContainerClient* client =
487 ServiceWorkerContainerClient::from(executionContext)) { 487 ServiceWorkerContainerClient::from(executionContext)) {
488 m_provider = client->provider(); 488 m_provider = client->provider();
489 if (m_provider) 489 if (m_provider)
490 m_provider->setClient(this); 490 m_provider->setClient(this);
491 } 491 }
492 } 492 }
493 493
494 } // namespace blink 494 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698