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

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: templatize duplicate code 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 27 matching lines...) Expand all
38 if (m_serializedData) 38 if (m_serializedData)
39 m_serializedData->registerMemoryAllocatedWithCurrentScriptContext(); 39 m_serializedData->registerMemoryAllocatedWithCurrentScriptContext();
40 } 40 }
41 41
42 ServiceWorkerMessageEvent::~ServiceWorkerMessageEvent() 42 ServiceWorkerMessageEvent::~ServiceWorkerMessageEvent()
43 { 43 {
44 } 44 }
45 45
46 MessagePortArray ServiceWorkerMessageEvent::ports(bool& isNull) const 46 MessagePortArray ServiceWorkerMessageEvent::ports(bool& isNull) const
47 { 47 {
48 // TODO(bashi): Currently we return a copied array because the binding
49 // layer could modify the content of the array while executing JS callbacks.
50 // Avoid copying once we can make sure that the binding layer won't
51 // modify the content.
48 if (m_ports) { 52 if (m_ports) {
49 isNull = false; 53 isNull = false;
50 return *m_ports; 54 return *m_ports;
51 } 55 }
52 isNull = true; 56 isNull = true;
53 return MessagePortArray(); 57 return MessagePortArray();
54 } 58 }
55 59
56 MessagePortArray ServiceWorkerMessageEvent::ports() const 60 MessagePortArray ServiceWorkerMessageEvent::ports() const
57 { 61 {
(...skipping 16 matching lines...) Expand all
74 78
75 DEFINE_TRACE(ServiceWorkerMessageEvent) 79 DEFINE_TRACE(ServiceWorkerMessageEvent)
76 { 80 {
77 visitor->trace(m_sourceAsServiceWorker); 81 visitor->trace(m_sourceAsServiceWorker);
78 visitor->trace(m_sourceAsMessagePort); 82 visitor->trace(m_sourceAsMessagePort);
79 visitor->trace(m_ports); 83 visitor->trace(m_ports);
80 Event::trace(visitor); 84 Event::trace(visitor);
81 } 85 }
82 86
83 } // namespace blink 87 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698