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

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

Issue 1658073002: ServiceWorker: Implement attributes of ExtendableMessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address falken's comments Created 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/ServiceWorkerMessageEvent.h" 5 #include "modules/serviceworkers/ServiceWorkerMessageEvent.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 ServiceWorkerMessageEvent::ServiceWorkerMessageEvent() 9 ServiceWorkerMessageEvent::ServiceWorkerMessageEvent()
10 { 10 {
(...skipping 29 matching lines...) Expand all
40 if (m_serializedData) 40 if (m_serializedData)
41 m_serializedData->registerMemoryAllocatedWithCurrentScriptContext(); 41 m_serializedData->registerMemoryAllocatedWithCurrentScriptContext();
42 } 42 }
43 43
44 ServiceWorkerMessageEvent::~ServiceWorkerMessageEvent() 44 ServiceWorkerMessageEvent::~ServiceWorkerMessageEvent()
45 { 45 {
46 } 46 }
47 47
48 MessagePortArray ServiceWorkerMessageEvent::ports(bool& isNull) const 48 MessagePortArray ServiceWorkerMessageEvent::ports(bool& isNull) const
49 { 49 {
50 // TODO(bashi): Currently we return a copied array because the binding
51 // layer could modify the content of the array while executing JS callbacks.
52 // Avoid copying once we can make sure that the binding layer won't
53 // modify the content.
50 if (m_ports) { 54 if (m_ports) {
51 isNull = false; 55 isNull = false;
52 return *m_ports; 56 return *m_ports;
53 } 57 }
54 isNull = true; 58 isNull = true;
55 return MessagePortArray(); 59 return MessagePortArray();
56 } 60 }
57 61
58 MessagePortArray ServiceWorkerMessageEvent::ports() const 62 MessagePortArray ServiceWorkerMessageEvent::ports() const
59 { 63 {
(...skipping 16 matching lines...) Expand all
76 80
77 DEFINE_TRACE(ServiceWorkerMessageEvent) 81 DEFINE_TRACE(ServiceWorkerMessageEvent)
78 { 82 {
79 visitor->trace(m_sourceAsServiceWorker); 83 visitor->trace(m_sourceAsServiceWorker);
80 visitor->trace(m_sourceAsMessagePort); 84 visitor->trace(m_sourceAsMessagePort);
81 visitor->trace(m_ports); 85 visitor->trace(m_ports);
82 Event::trace(visitor); 86 Event::trace(visitor);
83 } 87 }
84 88
85 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698