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

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

Issue 1706413002: Indexed DB: Rename "int version" to "version" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 9 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (!version) { 97 if (!version) {
98 exceptionState.throwTypeError("The version provided must not be 0."); 98 exceptionState.throwTypeError("The version provided must not be 0.");
99 return nullptr; 99 return nullptr;
100 } 100 }
101 return openInternal(scriptState, name, version, exceptionState); 101 return openInternal(scriptState, name, version, exceptionState);
102 } 102 }
103 103
104 IDBOpenDBRequest* IDBFactory::openInternal(ScriptState* scriptState, const Strin g& name, int64_t version, ExceptionState& exceptionState) 104 IDBOpenDBRequest* IDBFactory::openInternal(ScriptState* scriptState, const Strin g& name, int64_t version, ExceptionState& exceptionState)
105 { 105 {
106 IDBDatabase::recordApiCallsHistogram(IDBOpenCall); 106 IDBDatabase::recordApiCallsHistogram(IDBOpenCall);
107 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion); 107 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoVersion);
108 if (!isContextValid(scriptState->executionContext())) 108 if (!isContextValid(scriptState->executionContext()))
109 return nullptr; 109 return nullptr;
110 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) { 110 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) {
111 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context."); 111 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context.");
112 return nullptr; 112 return nullptr;
113 } 113 }
114 114
115 IDBDatabaseCallbacks* databaseCallbacks = IDBDatabaseCallbacks::create(); 115 IDBDatabaseCallbacks* databaseCallbacks = IDBDatabaseCallbacks::create();
116 int64_t transactionId = IDBDatabase::nextTransactionId(); 116 int64_t transactionId = IDBDatabase::nextTransactionId();
117 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, databaseCa llbacks, transactionId, version); 117 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, databaseCa llbacks, transactionId, version);
118 118
119 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) { 119 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) {
120 request->onError(DOMException::create(UnknownError, permissionDeniedErro rMessage)); 120 request->onError(DOMException::create(UnknownError, permissionDeniedErro rMessage));
121 return request; 121 return request;
122 } 122 }
123 123
124 Platform::current()->idbFactory()->open(name, version, transactionId, WebIDB CallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::create(da tabaseCallbacks).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin())); 124 Platform::current()->idbFactory()->open(name, version, transactionId, WebIDB CallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::create(da tabaseCallbacks).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin()));
125 return request; 125 return request;
126 } 126 }
127 127
128 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, ExceptionState& exceptionState) 128 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, ExceptionState& exceptionState)
129 { 129 {
130 IDB_TRACE("IDBFactory::open"); 130 IDB_TRACE("IDBFactory::open");
131 return openInternal(scriptState, name, IDBDatabaseMetadata::NoIntVersion, ex ceptionState); 131 return openInternal(scriptState, name, IDBDatabaseMetadata::NoVersion, excep tionState);
132 } 132 }
133 133
134 IDBOpenDBRequest* IDBFactory::deleteDatabase(ScriptState* scriptState, const Str ing& name, ExceptionState& exceptionState) 134 IDBOpenDBRequest* IDBFactory::deleteDatabase(ScriptState* scriptState, const Str ing& name, ExceptionState& exceptionState)
135 { 135 {
136 IDB_TRACE("IDBFactory::deleteDatabase"); 136 IDB_TRACE("IDBFactory::deleteDatabase");
137 IDBDatabase::recordApiCallsHistogram(IDBDeleteDatabaseCall); 137 IDBDatabase::recordApiCallsHistogram(IDBDeleteDatabaseCall);
138 if (!isContextValid(scriptState->executionContext())) 138 if (!isContextValid(scriptState->executionContext()))
139 return nullptr; 139 return nullptr;
140 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) { 140 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) {
141 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context."); 141 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context.");
142 return nullptr; 142 return nullptr;
143 } 143 }
144 144
145 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, nullptr, 0 , IDBDatabaseMetadata::DefaultIntVersion); 145 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, nullptr, 0 , IDBDatabaseMetadata::DefaultVersion);
146 146
147 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) { 147 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) {
148 request->onError(DOMException::create(UnknownError, permissionDeniedErro rMessage)); 148 request->onError(DOMException::create(UnknownError, permissionDeniedErro rMessage));
149 return request; 149 return request;
150 } 150 }
151 151
152 Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl: :create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin())); 152 Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl: :create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin()));
153 return request; 153 return request;
154 } 154 }
155 155
(...skipping 14 matching lines...) Expand all
170 ASSERT(second); 170 ASSERT(second);
171 if (!second->isValid()) { 171 if (!second->isValid()) {
172 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 172 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
173 return 0; 173 return 0;
174 } 174 }
175 175
176 return static_cast<short>(first->compare(second)); 176 return static_cast<short>(first->compare(second));
177 } 177 }
178 178
179 } // namespace blink 179 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp ('k') | third_party/WebKit/Source/modules/indexeddb/IDBMetadata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698