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

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

Issue 555633002: Make IDBTransaction ctor take ScriptState instead of ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.idl ('k') | Source/modules/indexeddb/IDBRequest.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) 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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/indexeddb/IDBOpenDBRequest.h" 27 #include "modules/indexeddb/IDBOpenDBRequest.h"
28 28
29 #include "bindings/core/v8/Nullable.h" 29 #include "bindings/core/v8/Nullable.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/dom/ExecutionContext.h" 31 #include "core/dom/ExecutionContext.h"
32 #include "modules/indexeddb/IDBDatabase.h" 32 #include "modules/indexeddb/IDBDatabase.h"
33 #include "modules/indexeddb/IDBDatabaseCallbacks.h" 33 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
34 #include "modules/indexeddb/IDBPendingTransactionMonitor.h"
35 #include "modules/indexeddb/IDBTracing.h" 34 #include "modules/indexeddb/IDBTracing.h"
36 #include "modules/indexeddb/IDBVersionChangeEvent.h" 35 #include "modules/indexeddb/IDBVersionChangeEvent.h"
37 36
38 using blink::WebIDBDatabase; 37 using blink::WebIDBDatabase;
39 38
40 namespace blink { 39 namespace blink {
41 40
42 IDBOpenDBRequest* IDBOpenDBRequest::create(ScriptState* scriptState, IDBDatabase Callbacks* callbacks, int64_t transactionId, int64_t version) 41 IDBOpenDBRequest* IDBOpenDBRequest::create(ScriptState* scriptState, IDBDatabase Callbacks* callbacks, int64_t transactionId, int64_t version)
43 { 42 {
44 IDBOpenDBRequest* request = adoptRefCountedGarbageCollectedWillBeNoop(new ID BOpenDBRequest(scriptState, callbacks, transactionId, version)); 43 IDBOpenDBRequest* request = adoptRefCountedGarbageCollectedWillBeNoop(new ID BOpenDBRequest(scriptState, callbacks, transactionId, version));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 IDBDatabase* idbDatabase = IDBDatabase::create(executionContext(), backend, m_databaseCallbacks.release()); 95 IDBDatabase* idbDatabase = IDBDatabase::create(executionContext(), backend, m_databaseCallbacks.release());
97 idbDatabase->setMetadata(metadata); 96 idbDatabase->setMetadata(metadata);
98 97
99 if (oldVersion == IDBDatabaseMetadata::NoIntVersion) { 98 if (oldVersion == IDBDatabaseMetadata::NoIntVersion) {
100 // This database hasn't had an integer version before. 99 // This database hasn't had an integer version before.
101 oldVersion = IDBDatabaseMetadata::DefaultIntVersion; 100 oldVersion = IDBDatabaseMetadata::DefaultIntVersion;
102 } 101 }
103 IDBDatabaseMetadata oldMetadata(metadata); 102 IDBDatabaseMetadata oldMetadata(metadata);
104 oldMetadata.intVersion = oldVersion; 103 oldMetadata.intVersion = oldVersion;
105 104
106 m_transaction = IDBTransaction::create(executionContext(), m_transactionId, idbDatabase, this, oldMetadata); 105 m_transaction = IDBTransaction::create(scriptState(), m_transactionId, idbDa tabase, this, oldMetadata);
107 setResult(IDBAny::create(idbDatabase)); 106 setResult(IDBAny::create(idbDatabase));
108 107
109 if (m_version == IDBDatabaseMetadata::NoIntVersion) 108 if (m_version == IDBDatabaseMetadata::NoIntVersion)
110 m_version = 1; 109 m_version = 1;
111 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol dVersion, m_version, dataLoss, dataLossMessage)); 110 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol dVersion, m_version, dataLoss, dataLossMessage));
112 } 111 }
113 112
114 void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDa tabaseMetadata& metadata) 113 void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDa tabaseMetadata& metadata)
115 { 114 {
116 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); 115 IDB_TRACE("IDBOpenDBRequest::onSuccess()");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 dequeueEvent(event.get()); 170 dequeueEvent(event.get());
172 setResult(0); 171 setResult(0);
173 onError(DOMError::create(AbortError, "The connection was closed.")); 172 onError(DOMError::create(AbortError, "The connection was closed."));
174 return false; 173 return false;
175 } 174 }
176 175
177 return IDBRequest::dispatchEvent(event); 176 return IDBRequest::dispatchEvent(event);
178 } 177 }
179 178
180 } // namespace blink 179 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.idl ('k') | Source/modules/indexeddb/IDBRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698