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

Side by Side Diff: Source/modules/push_messaging/PushEvent.cpp

Issue 780963004: Use event init dictionaries in modules/{notifications,push_messaging,serviceworkers} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/push_messaging/PushEvent.h" 6 #include "modules/push_messaging/PushEvent.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 PushEventInit::PushEventInit()
11 {
12 }
13
14 PushEvent::PushEvent() 10 PushEvent::PushEvent()
15 { 11 {
16 } 12 }
17 13
18 PushEvent::PushEvent(const AtomicString& type, PushMessageData* data, WaitUntilO bserver* observer) 14 PushEvent::PushEvent(const AtomicString& type, PushMessageData* data, WaitUntilO bserver* observer)
19 : ExtendableEvent(type, ExtendableEventInit(), observer) 15 : ExtendableEvent(type, ExtendableEventInit(), observer)
20 , m_data(data) 16 , m_data(data)
21 { 17 {
22 } 18 }
23 19
24 PushEvent::PushEvent(const AtomicString& type, const PushEventInit& initializer) 20 PushEvent::PushEvent(const AtomicString& type, const PushEventInit& initializer)
25 : ExtendableEvent(type, initializer) 21 : ExtendableEvent(type, initializer)
26 , m_data(initializer.data)
27 { 22 {
23 if (initializer.hasData())
24 m_data = initializer.data();
28 } 25 }
29 26
30 PushEvent::~PushEvent() 27 PushEvent::~PushEvent()
31 { 28 {
32 } 29 }
33 30
34 const AtomicString& PushEvent::interfaceName() const 31 const AtomicString& PushEvent::interfaceName() const
35 { 32 {
36 return EventNames::PushEvent; 33 return EventNames::PushEvent;
37 } 34 }
38 35
39 PushMessageData* PushEvent::data() 36 PushMessageData* PushEvent::data()
40 { 37 {
41 if (!m_data) 38 if (!m_data)
42 m_data = PushMessageData::create(); 39 m_data = PushMessageData::create();
43 40
44 return m_data.get(); 41 return m_data.get();
45 } 42 }
46 43
47 void PushEvent::trace(Visitor* visitor) 44 void PushEvent::trace(Visitor* visitor)
48 { 45 {
49 visitor->trace(m_data); 46 visitor->trace(m_data);
50 ExtendableEvent::trace(visitor); 47 ExtendableEvent::trace(visitor);
51 } 48 }
52 49
53 } // namespace blink 50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698