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

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

Issue 2567913002: Rename ActiveDOMObject to SuspendableObject (Closed)
Patch Set: Created 4 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // are not associated with transactions. 60 // are not associated with transactions.
61 if (transaction) 61 if (transaction)
62 transaction->registerRequest(request); 62 transaction->registerRequest(request);
63 return request; 63 return request;
64 } 64 }
65 65
66 IDBRequest::IDBRequest(ScriptState* scriptState, 66 IDBRequest::IDBRequest(ScriptState* scriptState,
67 IDBAny* source, 67 IDBAny* source,
68 IDBTransaction* transaction) 68 IDBTransaction* transaction)
69 : ActiveScriptWrappable(this), 69 : ActiveScriptWrappable(this),
70 ActiveDOMObject(scriptState->getExecutionContext()), 70 SuspendableObject(scriptState->getExecutionContext()),
71 m_transaction(transaction), 71 m_transaction(transaction),
72 m_source(source) {} 72 m_source(source) {}
73 73
74 IDBRequest::~IDBRequest() { 74 IDBRequest::~IDBRequest() {
75 DCHECK(m_readyState == DONE || m_readyState == EarlyDeath || 75 DCHECK(m_readyState == DONE || m_readyState == EarlyDeath ||
76 !getExecutionContext()); 76 !getExecutionContext());
77 } 77 }
78 78
79 DEFINE_TRACE(IDBRequest) { 79 DEFINE_TRACE(IDBRequest) {
80 visitor->trace(m_transaction); 80 visitor->trace(m_transaction);
81 visitor->trace(m_source); 81 visitor->trace(m_source);
82 visitor->trace(m_result); 82 visitor->trace(m_result);
83 visitor->trace(m_error); 83 visitor->trace(m_error);
84 visitor->trace(m_enqueuedEvents); 84 visitor->trace(m_enqueuedEvents);
85 visitor->trace(m_pendingCursor); 85 visitor->trace(m_pendingCursor);
86 visitor->trace(m_cursorKey); 86 visitor->trace(m_cursorKey);
87 visitor->trace(m_cursorPrimaryKey); 87 visitor->trace(m_cursorPrimaryKey);
88 EventTargetWithInlineData::trace(visitor); 88 EventTargetWithInlineData::trace(visitor);
89 ActiveDOMObject::trace(visitor); 89 SuspendableObject::trace(visitor);
90 } 90 }
91 91
92 ScriptValue IDBRequest::result(ScriptState* scriptState, 92 ScriptValue IDBRequest::result(ScriptState* scriptState,
93 ExceptionState& exceptionState) { 93 ExceptionState& exceptionState) {
94 if (m_readyState != DONE) { 94 if (m_readyState != DONE) {
95 // Must throw if returning an empty value. Message is arbitrary since it 95 // Must throw if returning an empty value. Message is arbitrary since it
96 // will never be seen. 96 // will never be seen.
97 exceptionState.throwDOMException( 97 exceptionState.throwDOMException(
98 InvalidStateError, IDBDatabase::requestNotFinishedErrorMessage); 98 InvalidStateError, IDBDatabase::requestNotFinishedErrorMessage);
99 return ScriptValue(); 99 return ScriptValue();
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 m_webCallbacks->detach(); 408 m_webCallbacks->detach();
409 m_webCallbacks = nullptr; 409 m_webCallbacks = nullptr;
410 } 410 }
411 } 411 }
412 412
413 const AtomicString& IDBRequest::interfaceName() const { 413 const AtomicString& IDBRequest::interfaceName() const {
414 return EventTargetNames::IDBRequest; 414 return EventTargetNames::IDBRequest;
415 } 415 }
416 416
417 ExecutionContext* IDBRequest::getExecutionContext() const { 417 ExecutionContext* IDBRequest::getExecutionContext() const {
418 return ActiveDOMObject::getExecutionContext(); 418 return SuspendableObject::getExecutionContext();
419 } 419 }
420 420
421 DispatchEventResult IDBRequest::dispatchEventInternal(Event* event) { 421 DispatchEventResult IDBRequest::dispatchEventInternal(Event* event) {
422 IDB_TRACE("IDBRequest::dispatchEvent"); 422 IDB_TRACE("IDBRequest::dispatchEvent");
423 if (!getExecutionContext()) 423 if (!getExecutionContext())
424 return DispatchEventResult::CanceledBeforeDispatch; 424 return DispatchEventResult::CanceledBeforeDispatch;
425 DCHECK_EQ(m_readyState, PENDING); 425 DCHECK_EQ(m_readyState, PENDING);
426 DCHECK(m_hasPendingActivity); 426 DCHECK(m_hasPendingActivity);
427 DCHECK(m_enqueuedEvents.size()); 427 DCHECK(m_enqueuedEvents.size());
428 DCHECK_EQ(event->target(), this); 428 DCHECK_EQ(event->target(), this);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 551 }
552 552
553 void IDBRequest::dequeueEvent(Event* event) { 553 void IDBRequest::dequeueEvent(Event* event) {
554 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 554 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
555 if (m_enqueuedEvents[i].get() == event) 555 if (m_enqueuedEvents[i].get() == event)
556 m_enqueuedEvents.remove(i); 556 m_enqueuedEvents.remove(i);
557 } 557 }
558 } 558 }
559 559
560 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698