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

Side by Side Diff: Source/modules/serviceworkers/StashedPortCollection.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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/serviceworkers/StashedPortCollection.h"
7
8 #include "bindings/core/v8/SerializedScriptValueFactory.h"
9 #include "modules/EventTargetModules.h"
10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
11 #include "modules/serviceworkers/StashedMessagePort.h"
12 #include "public/platform/WebString.h"
13
14 namespace blink {
15
16 PassRefPtrWillBeRawPtr<StashedPortCollection> StashedPortCollection::create(Exec utionContext* context)
17 {
18 return adoptRefWillBeNoop(new StashedPortCollection(context));
19 }
20
21 StashedPortCollection::StashedPortCollection(ExecutionContext* context)
22 : ContextLifecycleObserver(context)
23 {
24 }
25
26 StashedPortCollection::~StashedPortCollection()
27 {
28 }
29
30 void StashedPortCollection::addPorts(const StashedMessagePortArray& ports)
31 {
32 m_ports.appendVector(ports);
33 }
34
35 PassRefPtrWillBeRawPtr<StashedMessagePort> StashedPortCollection::add(ScriptStat e* scriptState, const String& name, MessagePort* port)
36 {
37 OwnPtr<WebMessagePortChannel> webChannel = port->disentangle();
38 ServiceWorkerGlobalScopeClient::from(executionContext())->stashMessagePort(w ebChannel.get(), name);
39 RefPtrWillBeRawPtr<StashedMessagePort> stashedPort = StashedMessagePort::cre ate(*executionContext(), webChannel.release(), name);
40 m_ports.append(stashedPort);
41 return stashedPort;
42 }
43
44 const AtomicString& StashedPortCollection::interfaceName() const
45 {
46 return EventTargetNames::StashedPortCollection;
47 }
48
49 ExecutionContext* StashedPortCollection::executionContext() const
50 {
51 return ContextLifecycleObserver::executionContext();
52 }
53
54 DEFINE_TRACE(StashedPortCollection)
55 {
56 EventTargetWithInlineData::trace(visitor);
57 ContextLifecycleObserver::trace(visitor);
58 }
59
60 } // namespace blink
61
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/StashedPortCollection.h ('k') | Source/modules/serviceworkers/StashedPortCollection.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698