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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp

Issue 2473203002: IndexedDB: Remove m_contextStopped from ActiveDOMObjecs (Closed)
Patch Set: Created 4 years, 1 month 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 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (oldVersion == IDBDatabaseMetadata::NoVersion) { 154 if (oldVersion == IDBDatabaseMetadata::NoVersion) {
155 // This database hasn't had an integer version before. 155 // This database hasn't had an integer version before.
156 oldVersion = IDBDatabaseMetadata::DefaultVersion; 156 oldVersion = IDBDatabaseMetadata::DefaultVersion;
157 } 157 }
158 setResult(IDBAny::createUndefined()); 158 setResult(IDBAny::createUndefined());
159 enqueueEvent(IDBVersionChangeEvent::create( 159 enqueueEvent(IDBVersionChangeEvent::create(
160 EventTypeNames::success, oldVersion, Nullable<unsigned long long>())); 160 EventTypeNames::success, oldVersion, Nullable<unsigned long long>()));
161 } 161 }
162 162
163 bool IDBOpenDBRequest::shouldEnqueueEvent() const { 163 bool IDBOpenDBRequest::shouldEnqueueEvent() const {
164 if (m_contextStopped || !getExecutionContext()) 164 if (!getExecutionContext())
165 return false; 165 return false;
166 DCHECK(m_readyState == PENDING || m_readyState == DONE); 166 DCHECK(m_readyState == PENDING || m_readyState == DONE);
167 if (m_requestAborted) 167 if (m_requestAborted)
168 return false; 168 return false;
169 return true; 169 return true;
170 } 170 }
171 171
172 DispatchEventResult IDBOpenDBRequest::dispatchEventInternal(Event* event) { 172 DispatchEventResult IDBOpenDBRequest::dispatchEventInternal(Event* event) {
173 // If the connection closed between onUpgradeNeeded and the delivery of the 173 // If the connection closed between onUpgradeNeeded and the delivery of the
174 // "success" event, an "error" event should be fired instead. 174 // "success" event, an "error" event should be fired instead.
175 if (event->type() == EventTypeNames::success && 175 if (event->type() == EventTypeNames::success &&
176 resultAsAny()->getType() == IDBAny::IDBDatabaseType && 176 resultAsAny()->getType() == IDBAny::IDBDatabaseType &&
177 resultAsAny()->idbDatabase()->isClosePending()) { 177 resultAsAny()->idbDatabase()->isClosePending()) {
178 dequeueEvent(event); 178 dequeueEvent(event);
179 setResult(nullptr); 179 setResult(nullptr);
180 onError(DOMException::create(AbortError, "The connection was closed.")); 180 onError(DOMException::create(AbortError, "The connection was closed."));
181 return DispatchEventResult::CanceledBeforeDispatch; 181 return DispatchEventResult::CanceledBeforeDispatch;
182 } 182 }
183 183
184 return IDBRequest::dispatchEventInternal(event); 184 return IDBRequest::dispatchEventInternal(event);
185 } 185 }
186 186
187 } // namespace blink 187 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp ('k') | third_party/WebKit/Source/modules/indexeddb/IDBRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698