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

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

Issue 78053006: [oilpan] Move IDBDatabase, IDBDatabaseCallbacks, IDBDatabaseBackendInterface and other related clas… (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBRequest.h ('k') | Source/modules/indexeddb/IDBTransaction.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 #include "modules/indexeddb/IDBCursorWithValue.h" 40 #include "modules/indexeddb/IDBCursorWithValue.h"
41 #include "modules/indexeddb/IDBDatabase.h" 41 #include "modules/indexeddb/IDBDatabase.h"
42 #include "modules/indexeddb/IDBEventDispatcher.h" 42 #include "modules/indexeddb/IDBEventDispatcher.h"
43 #include "modules/indexeddb/IDBTracing.h" 43 #include "modules/indexeddb/IDBTracing.h"
44 #include "modules/indexeddb/IDBTransaction.h" 44 #include "modules/indexeddb/IDBTransaction.h"
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 DEFINE_GC_INFO(IDBCallbacks); 48 DEFINE_GC_INFO(IDBCallbacks);
49 49
50 PassRefPtr<IDBRequest> IDBRequest::create(ScriptExecutionContext* context, PassR efPtr<IDBAny> source, IDBTransaction* transaction) 50 IDBRequest* IDBRequest::create(ScriptExecutionContext* context, PassRefPtr<IDBAn y> source, IDBTransaction* transaction)
51 { 51 {
52 RefPtr<IDBRequest> request(adoptRef(new IDBRequest(context, source, IDBDatab aseBackendInterface::NormalTask, transaction))); 52 IDBRequest* request = new IDBRequest(context, source, IDBDatabaseBackendInte rface::NormalTask, transaction);
53 request->suspendIfNeeded(); 53 request->suspendIfNeeded();
54 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames ) are not associated with transactions. 54 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames ) are not associated with transactions.
55 if (transaction) 55 if (transaction)
56 transaction->registerRequest(request.get()); 56 transaction->registerRequest(request);
57 return request.release(); 57 return request;
58 } 58 }
59 59
60 PassRefPtr<IDBRequest> IDBRequest::create(ScriptExecutionContext* context, PassR efPtr<IDBAny> source, IDBDatabaseBackendInterface::TaskType taskType, IDBTransac tion* transaction) 60 IDBRequest* IDBRequest::create(ScriptExecutionContext* context, PassRefPtr<IDBAn y> source, IDBDatabaseBackendInterface::TaskType taskType, IDBTransaction* trans action)
61 { 61 {
62 RefPtr<IDBRequest> request(adoptRef(new IDBRequest(context, source, taskType , transaction))); 62 IDBRequest* request = new IDBRequest(context, source, taskType, transaction) ;
63 request->suspendIfNeeded(); 63 request->suspendIfNeeded();
64 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames ) are not associated with transactions. 64 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames ) are not associated with transactions.
65 if (transaction) 65 if (transaction)
66 transaction->registerRequest(request.get()); 66 transaction->registerRequest(request);
67 return request.release(); 67 return request;
68 } 68 }
69 69
70 IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc e, IDBDatabaseBackendInterface::TaskType taskType, IDBTransaction* transaction) 70 IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc e, IDBDatabaseBackendInterface::TaskType taskType, IDBTransaction* transaction)
71 : ActiveDOMObject(context) 71 : ActiveDOMObject(context)
72 , m_result(0) 72 , m_result(0)
73 , m_errorCode(0) 73 , m_errorCode(0)
74 , m_contextStopped(false) 74 , m_contextStopped(false)
75 , m_transaction(transaction) 75 , m_transaction(transaction)
76 , m_readyState(PENDING) 76 , m_readyState(PENDING)
77 , m_requestAborted(false) 77 , m_requestAborted(false)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 void IDBRequest::abort() 165 void IDBRequest::abort()
166 { 166 {
167 ASSERT(!m_requestAborted); 167 ASSERT(!m_requestAborted);
168 if (m_contextStopped || !scriptExecutionContext()) 168 if (m_contextStopped || !scriptExecutionContext())
169 return; 169 return;
170 ASSERT(m_readyState == PENDING || m_readyState == DONE); 170 ASSERT(m_readyState == PENDING || m_readyState == DONE);
171 if (m_readyState == DONE) 171 if (m_readyState == DONE)
172 return; 172 return;
173 173
174 // Enqueued events may be the only reference to this object.
175 RefPtr<IDBRequest> self(this);
176
177 EventQueue* eventQueue = scriptExecutionContext()->eventQueue(); 174 EventQueue* eventQueue = scriptExecutionContext()->eventQueue();
178 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 175 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
179 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); 176 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get());
180 ASSERT_UNUSED(removed, removed); 177 ASSERT_UNUSED(removed, removed);
181 } 178 }
182 m_enqueuedEvents.clear(); 179 m_enqueuedEvents.clear();
183 180
184 m_errorCode = 0; 181 m_errorCode = 0;
185 m_error.clear(); 182 m_error.clear();
186 m_errorMessage = String(); 183 m_errorMessage = String();
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 EventTargetData* IDBRequest::eventTargetData() 565 EventTargetData* IDBRequest::eventTargetData()
569 { 566 {
570 return &m_eventTargetData; 567 return &m_eventTargetData;
571 } 568 }
572 569
573 EventTargetData* IDBRequest::ensureEventTargetData() 570 EventTargetData* IDBRequest::ensureEventTargetData()
574 { 571 {
575 return &m_eventTargetData; 572 return &m_eventTargetData;
576 } 573 }
577 574
575 void IDBRequest::trace(Visitor* visitor)
576 {
577 IDBCallbacks::trace(visitor);
578 }
579
580
578 } // namespace WebCore 581 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBRequest.h ('k') | Source/modules/indexeddb/IDBTransaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698