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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 IDBRequest::IDBRequest(ExecutionContext* context, PassRefPtr<IDBAny> source, IDB Transaction* transaction) 57 IDBRequest::IDBRequest(ExecutionContext* context, PassRefPtr<IDBAny> source, IDB Transaction* transaction)
58 : ActiveDOMObject(context) 58 : ActiveDOMObject(context)
59 , m_contextStopped(false) 59 , m_contextStopped(false)
60 , m_transaction(transaction) 60 , m_transaction(transaction)
61 , m_readyState(PENDING) 61 , m_readyState(PENDING)
62 , m_requestAborted(false) 62 , m_requestAborted(false)
63 , m_source(source) 63 , m_source(source)
64 , m_hasPendingActivity(true) 64 , m_hasPendingActivity(true)
65 , m_cursorType(IndexedDB::CursorKeyAndValue) 65 , m_cursorType(IndexedDB::CursorKeyAndValue)
66 , m_cursorDirection(blink::WebIDBCursor::Next) 66 , m_cursorDirection(blink::WebIDBCursor::Next)
67 , m_pendingCursor(0) 67 , m_pendingCursor(nullptr)
68 , m_didFireUpgradeNeededEvent(false) 68 , m_didFireUpgradeNeededEvent(false)
69 , m_preventPropagation(false) 69 , m_preventPropagation(false)
70 , m_resultDirty(true) 70 , m_resultDirty(true)
71 , m_requestState(context) 71 , m_requestState(context)
72 { 72 {
73 ScriptWrappable::init(this); 73 ScriptWrappable::init(this);
74 } 74 }
75 75
76 IDBRequest::~IDBRequest() 76 IDBRequest::~IDBRequest()
77 { 77 {
78 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte xt()); 78 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte xt());
79 } 79 }
80 80
81 ScriptValue IDBRequest::result(ExceptionState& exceptionState) 81 ScriptValue IDBRequest::result(ExceptionState& exceptionState)
82 { 82 {
83 if (m_readyState != DONE) { 83 if (m_readyState != DONE) {
84 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage); 84 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage);
85 return ScriptValue(); 85 return ScriptValue();
86 } 86 }
87 m_resultDirty = false; 87 m_resultDirty = false;
88 return idbAnyToScriptValue(&m_requestState, m_result); 88 return idbAnyToScriptValue(&m_requestState, m_result);
89 } 89 }
90 90
91 PassRefPtr<DOMError> IDBRequest::error(ExceptionState& exceptionState) const 91 PassRefPtr<DOMError> IDBRequest::error(ExceptionState& exceptionState) const
92 { 92 {
93 if (m_readyState != DONE) { 93 if (m_readyState != DONE) {
94 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage); 94 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::request NotFinishedErrorMessage);
95 return 0; 95 return nullptr;
96 } 96 }
97 return m_error; 97 return m_error;
98 } 98 }
99 99
100 ScriptValue IDBRequest::source(ExecutionContext* context) const 100 ScriptValue IDBRequest::source(ExecutionContext* context) const
101 { 101 {
102 DOMRequestState requestState(context); 102 DOMRequestState requestState(context);
103 return idbAnyToScriptValue(&requestState, m_source); 103 return idbAnyToScriptValue(&requestState, m_source);
104 } 104 }
105 105
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void IDBRequest::setPendingCursor(PassRefPtr<IDBCursor> cursor) 151 void IDBRequest::setPendingCursor(PassRefPtr<IDBCursor> cursor)
152 { 152 {
153 ASSERT(m_readyState == DONE); 153 ASSERT(m_readyState == DONE);
154 ASSERT(executionContext()); 154 ASSERT(executionContext());
155 ASSERT(m_transaction); 155 ASSERT(m_transaction);
156 ASSERT(!m_pendingCursor); 156 ASSERT(!m_pendingCursor);
157 ASSERT(cursor == getResultCursor()); 157 ASSERT(cursor == getResultCursor());
158 158
159 m_hasPendingActivity = true; 159 m_hasPendingActivity = true;
160 m_pendingCursor = cursor; 160 m_pendingCursor = cursor;
161 setResult(PassRefPtr<IDBAny>(0)); 161 setResult(PassRefPtr<IDBAny>(nullptr));
162 m_readyState = PENDING; 162 m_readyState = PENDING;
163 m_error.clear(); 163 m_error.clear();
164 m_transaction->registerRequest(this); 164 m_transaction->registerRequest(this);
165 } 165 }
166 166
167 IDBCursor* IDBRequest::getResultCursor() const 167 IDBCursor* IDBRequest::getResultCursor() const
168 { 168 {
169 if (!m_result) 169 if (!m_result)
170 return 0; 170 return 0;
171 if (m_result->type() == IDBAny::IDBCursorType) 171 if (m_result->type() == IDBAny::IDBCursorType)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 #ifndef NDEBUG 286 #ifndef NDEBUG
287 static PassRefPtr<IDBObjectStore> effectiveObjectStore(PassRefPtr<IDBAny> source ) 287 static PassRefPtr<IDBObjectStore> effectiveObjectStore(PassRefPtr<IDBAny> source )
288 { 288 {
289 if (source->type() == IDBAny::IDBObjectStoreType) 289 if (source->type() == IDBAny::IDBObjectStoreType)
290 return source->idbObjectStore(); 290 return source->idbObjectStore();
291 if (source->type() == IDBAny::IDBIndexType) 291 if (source->type() == IDBAny::IDBIndexType)
292 return source->idbIndex()->objectStore(); 292 return source->idbIndex()->objectStore();
293 293
294 ASSERT_NOT_REACHED(); 294 ASSERT_NOT_REACHED();
295 return 0; 295 return nullptr;
296 } 296 }
297 #endif 297 #endif
298 298
299 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassRefPtr<I DBKey> prpPrimaryKey, const IDBKeyPath& keyPath) 299 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassRefPtr<I DBKey> prpPrimaryKey, const IDBKeyPath& keyPath)
300 { 300 {
301 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); 301 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)");
302 if (!shouldEnqueueEvent()) 302 if (!shouldEnqueueEvent())
303 return; 303 return;
304 304
305 #ifndef NDEBUG 305 #ifndef NDEBUG
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 516
517 void IDBRequest::dequeueEvent(Event* event) 517 void IDBRequest::dequeueEvent(Event* event)
518 { 518 {
519 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 519 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
520 if (m_enqueuedEvents[i].get() == event) 520 if (m_enqueuedEvents[i].get() == event)
521 m_enqueuedEvents.remove(i); 521 m_enqueuedEvents.remove(i);
522 } 522 }
523 } 523 }
524 524
525 } // namespace WebCore 525 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBOpenDBRequest.cpp ('k') | Source/modules/indexeddb/IDBRequestTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698