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

Side by Side Diff: third_party/WebKit/Source/core/events/GenericEventQueue.cpp

Issue 1852663002: Oilpan: Remove WillBe types (part 9) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org)
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "core/events/GenericEventQueue.h" 26 #include "core/events/GenericEventQueue.h"
27 27
28 #include "core/events/Event.h" 28 #include "core/events/Event.h"
29 #include "core/inspector/InspectorInstrumentation.h" 29 #include "core/inspector/InspectorInstrumentation.h"
30 #include "platform/TraceEvent.h" 30 #include "platform/TraceEvent.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 PassOwnPtrWillBeRawPtr<GenericEventQueue> GenericEventQueue::create(EventTarget* owner) 34 RawPtr<GenericEventQueue> GenericEventQueue::create(EventTarget* owner)
35 { 35 {
36 return adoptPtrWillBeNoop(new GenericEventQueue(owner)); 36 return new GenericEventQueue(owner);
37 } 37 }
38 38
39 GenericEventQueue::GenericEventQueue(EventTarget* owner) 39 GenericEventQueue::GenericEventQueue(EventTarget* owner)
40 : m_owner(owner) 40 : m_owner(owner)
41 , m_timer(this, &GenericEventQueue::timerFired) 41 , m_timer(this, &GenericEventQueue::timerFired)
42 , m_isClosed(false) 42 , m_isClosed(false)
43 { 43 {
44 } 44 }
45 45
46 GenericEventQueue::~GenericEventQueue() 46 GenericEventQueue::~GenericEventQueue()
47 { 47 {
48 } 48 }
49 49
50 DEFINE_TRACE(GenericEventQueue) 50 DEFINE_TRACE(GenericEventQueue)
51 { 51 {
52 visitor->trace(m_owner); 52 visitor->trace(m_owner);
53 visitor->trace(m_pendingEvents); 53 visitor->trace(m_pendingEvents);
54 EventQueue::trace(visitor); 54 EventQueue::trace(visitor);
55 } 55 }
56 56
57 bool GenericEventQueue::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) 57 bool GenericEventQueue::enqueueEvent(RawPtr<Event> event)
58 { 58 {
59 if (m_isClosed) 59 if (m_isClosed)
60 return false; 60 return false;
61 61
62 if (event->target() == m_owner) 62 if (event->target() == m_owner)
63 event->setTarget(nullptr); 63 event->setTarget(nullptr);
64 64
65 TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.ge t(), "type", event->type().ascii()); 65 TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.ge t(), "type", event->type().ascii());
66 InspectorInstrumentation::didEnqueueEvent(event->target() ? event->target() : m_owner.get(), event.get()); 66 InspectorInstrumentation::didEnqueueEvent(event->target() ? event->target() : m_owner.get(), event.get());
67 m_pendingEvents.append(event); 67 m_pendingEvents.append(event);
(...skipping 18 matching lines...) Expand all
86 m_timer.stop(); 86 m_timer.stop();
87 87
88 return found; 88 return found;
89 } 89 }
90 90
91 void GenericEventQueue::timerFired(Timer<GenericEventQueue>*) 91 void GenericEventQueue::timerFired(Timer<GenericEventQueue>*)
92 { 92 {
93 ASSERT(!m_timer.isActive()); 93 ASSERT(!m_timer.isActive());
94 ASSERT(!m_pendingEvents.isEmpty()); 94 ASSERT(!m_pendingEvents.isEmpty());
95 95
96 WillBeHeapVector<RefPtrWillBeMember<Event>> pendingEvents; 96 HeapVector<Member<Event>> pendingEvents;
97 m_pendingEvents.swap(pendingEvents); 97 m_pendingEvents.swap(pendingEvents);
98 98
99 RefPtrWillBeRawPtr<EventTarget> protect(m_owner.get()); 99 RawPtr<EventTarget> protect(m_owner.get());
100 for (const auto& pendingEvent : pendingEvents) { 100 for (const auto& pendingEvent : pendingEvents) {
101 Event* event = pendingEvent.get(); 101 Event* event = pendingEvent.get();
102 EventTarget* target = event->target() ? event->target() : m_owner.get(); 102 EventTarget* target = event->target() ? event->target() : m_owner.get();
103 CString type(event->type().ascii()); 103 CString type(event->type().ascii());
104 TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type); 104 TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
105 target->dispatchEvent(pendingEvent); 105 target->dispatchEvent(pendingEvent);
106 TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type); 106 TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
107 InspectorInstrumentation::didRemoveEvent(target, event); 107 InspectorInstrumentation::didRemoveEvent(target, event);
108 } 108 }
109 } 109 }
(...skipping 15 matching lines...) Expand all
125 } 125 }
126 m_pendingEvents.clear(); 126 m_pendingEvents.clear();
127 } 127 }
128 128
129 bool GenericEventQueue::hasPendingEvents() const 129 bool GenericEventQueue::hasPendingEvents() const
130 { 130 {
131 return m_pendingEvents.size(); 131 return m_pendingEvents.size();
132 } 132 }
133 133
134 } // namespace blink 134 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/GenericEventQueue.h ('k') | third_party/WebKit/Source/core/events/GestureEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698