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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Remove unnecessary histogram 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 if (m_controller) 437 if (m_controller)
438 UseCounter::count(getExecutionContext(), 438 UseCounter::count(getExecutionContext(),
439 UseCounter::ServiceWorkerControlledPage); 439 UseCounter::ServiceWorkerControlledPage);
440 if (shouldNotifyControllerChange) 440 if (shouldNotifyControllerChange)
441 dispatchEvent(Event::create(EventTypeNames::controllerchange)); 441 dispatchEvent(Event::create(EventTypeNames::controllerchange));
442 } 442 }
443 443
444 void ServiceWorkerContainer::dispatchMessageEvent( 444 void ServiceWorkerContainer::dispatchMessageEvent(
445 std::unique_ptr<WebServiceWorker::Handle> handle, 445 std::unique_ptr<WebServiceWorker::Handle> handle,
446 const WebString& message, 446 const WebString& message,
447 const WebMessagePortChannelArray& webChannels) { 447 WebMessagePortChannelArray webChannels) {
448 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) 448 if (!getExecutionContext() || !getExecutionContext()->executingWindow())
449 return; 449 return;
450 450
451 MessagePortArray* ports = 451 MessagePortArray* ports = MessagePort::toMessagePortArray(
452 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); 452 getExecutionContext(), std::move(webChannels));
453 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); 453 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message);
454 ServiceWorker* source = ServiceWorker::from( 454 ServiceWorker* source = ServiceWorker::from(
455 getExecutionContext(), WTF::wrapUnique(handle.release())); 455 getExecutionContext(), WTF::wrapUnique(handle.release()));
456 dispatchEvent(MessageEvent::create( 456 dispatchEvent(MessageEvent::create(
457 ports, value, getExecutionContext()->getSecurityOrigin()->toString(), 457 ports, value, getExecutionContext()->getSecurityOrigin()->toString(),
458 String() /* lastEventId */, source, String() /* suborigin */)); 458 String() /* lastEventId */, source, String() /* suborigin */));
459 } 459 }
460 460
461 const AtomicString& ServiceWorkerContainer::interfaceName() const { 461 const AtomicString& ServiceWorkerContainer::interfaceName() const {
462 return EventTargetNames::ServiceWorkerContainer; 462 return EventTargetNames::ServiceWorkerContainer;
(...skipping 10 matching lines...) Expand all
473 473
474 if (ServiceWorkerContainerClient* client = 474 if (ServiceWorkerContainerClient* client =
475 ServiceWorkerContainerClient::from(executionContext)) { 475 ServiceWorkerContainerClient::from(executionContext)) {
476 m_provider = client->provider(); 476 m_provider = client->provider();
477 if (m_provider) 477 if (m_provider)
478 m_provider->setClient(this); 478 m_provider->setClient(this);
479 } 479 }
480 } 480 }
481 481
482 } // namespace blink 482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698