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

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: 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/serviceworkers/ServiceWorkerGlobalScopeClient.h"
10 #include "modules/serviceworkers/StashedMessagePort.h"
11 #include "public/platform/WebString.h"
12
13 namespace blink {
14
15 PassRefPtrWillBeRawPtr<StashedPortCollection> StashedPortCollection::create(Exec utionContext* context)
16 {
17 return adoptRefWillBeNoop(new StashedPortCollection(context));
18 }
19
20 StashedPortCollection::StashedPortCollection(ExecutionContext* context)
21 : ContextLifecycleObserver(context)
22 {
23 }
24
25 StashedPortCollection::~StashedPortCollection()
26 {
27 }
28
29 PassRefPtrWillBeRawPtr<StashedMessagePort> StashedPortCollection::add(ScriptStat e* scriptState, const String& name, MessagePort* port)
30 {
31 OwnPtr<WebMessagePortChannel> webChannel = port->disentangle();
32 ServiceWorkerGlobalScopeClient::from(executionContext())->stashMessagePort(w ebChannel.get(), name);
33 RefPtrWillBeRawPtr<StashedMessagePort> stashedPort = StashedMessagePort::cre ate(*executionContext(), webChannel.release(), name);
34 m_ports.append(stashedPort);
35 return stashedPort;
36 }
37
38 void StashedPortCollection::addPorts(const StashedMessagePortArray& ports)
39 {
40 m_ports.appendVector(ports);
41 }
42
43 const AtomicString& StashedPortCollection::interfaceName() const
44 {
45 static AtomicString s;
scheib 2015/05/06 21:44:31 Document why empty string. From EventTarget: // -
Marijn Kruisselbrink 2015/05/12 06:56:41 My mistake, shouldn't be empty string of course.
46 return s;
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

Powered by Google App Engine
This is Rietveld 408576698