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

Side by Side Diff: third_party/WebKit/Source/modules/webmidi/MIDIPort.cpp

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 years, 11 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ExecutionContext* MIDIPort::getExecutionContext() const { 148 ExecutionContext* MIDIPort::getExecutionContext() const {
149 return m_access->getExecutionContext(); 149 return m_access->getExecutionContext();
150 } 150 }
151 151
152 bool MIDIPort::hasPendingActivity() const { 152 bool MIDIPort::hasPendingActivity() const {
153 // MIDIPort should survive if ConnectionState is "open" or can be "open" via 153 // MIDIPort should survive if ConnectionState is "open" or can be "open" via
154 // a MIDIConnectionEvent even if there are no references from JavaScript. 154 // a MIDIConnectionEvent even if there are no references from JavaScript.
155 return m_connection != ConnectionStateClosed; 155 return m_connection != ConnectionStateClosed;
156 } 156 }
157 157
158 void MIDIPort::contextDestroyed() { 158 void MIDIPort::contextDestroyed(ExecutionContext*) {
159 // Should be "closed" to assume there are no pending activities. 159 // Should be "closed" to assume there are no pending activities.
160 m_connection = ConnectionStateClosed; 160 m_connection = ConnectionStateClosed;
161 } 161 }
162 162
163 DEFINE_TRACE(MIDIPort) { 163 DEFINE_TRACE(MIDIPort) {
164 visitor->trace(m_access); 164 visitor->trace(m_access);
165 EventTargetWithInlineData::trace(visitor); 165 EventTargetWithInlineData::trace(visitor);
166 ContextLifecycleObserver::trace(visitor); 166 ContextLifecycleObserver::trace(visitor);
167 } 167 }
168 168
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); 204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen);
205 if (m_state == state && m_connection == connection) 205 if (m_state == state && m_connection == connection)
206 return; 206 return;
207 m_state = state; 207 m_state = state;
208 m_connection = connection; 208 m_connection = connection;
209 dispatchEvent(MIDIConnectionEvent::create(this)); 209 dispatchEvent(MIDIConnectionEvent::create(this));
210 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); 210 m_access->dispatchEvent(MIDIConnectionEvent::create(this));
211 } 211 }
212 212
213 } // namespace blink 213 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webmidi/MIDIPort.h ('k') | third_party/WebKit/Source/modules/websockets/DOMWebSocket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698