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

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

Issue 464353002: Cleanup blink:: prefix usage in Source/core/modules/[battery/*.cpp to indexeddb/*.cpp] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 4 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
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBIndex.cpp » ('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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return 0; 81 return 0;
82 } 82 }
83 83
84 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::createNull(), 0); 84 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::createNull(), 0);
85 85
86 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), "Da tabase Listing")) { 86 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), "Da tabase Listing")) {
87 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage)); 87 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage));
88 return request; 88 return request;
89 } 89 }
90 90
91 blink::Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksIm pl::create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(script State->executionContext()->securityOrigin())); 91 Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::cre ate(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptState-> executionContext()->securityOrigin()));
92 return request; 92 return request;
93 } 93 }
94 94
95 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, unsigned long long version, ExceptionState& exceptionState) 95 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, unsigned long long version, ExceptionState& exceptionState)
96 { 96 {
97 IDB_TRACE("IDBFactory::open"); 97 IDB_TRACE("IDBFactory::open");
98 if (!version) { 98 if (!version) {
99 exceptionState.throwTypeError("The version provided must not be 0."); 99 exceptionState.throwTypeError("The version provided must not be 0.");
100 return 0; 100 return 0;
101 } 101 }
102 return openInternal(scriptState, name, version, exceptionState); 102 return openInternal(scriptState, name, version, exceptionState);
103 } 103 }
104 104
105 IDBOpenDBRequest* IDBFactory::openInternal(ScriptState* scriptState, const Strin g& name, int64_t version, ExceptionState& exceptionState) 105 IDBOpenDBRequest* IDBFactory::openInternal(ScriptState* scriptState, const Strin g& name, int64_t version, ExceptionState& exceptionState)
106 { 106 {
107 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd APICalls", IDBOpenCall, IDBMethodsMax); 107 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall s", IDBOpenCall, IDBMethodsMax);
108 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion); 108 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion);
109 if (name.isNull()) { 109 if (name.isNull()) {
110 exceptionState.throwTypeError("The name provided must not be empty."); 110 exceptionState.throwTypeError("The name provided must not be empty.");
111 return 0; 111 return 0;
112 } 112 }
113 if (!isContextValid(scriptState->executionContext())) 113 if (!isContextValid(scriptState->executionContext()))
114 return nullptr; 114 return nullptr;
115 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) { 115 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) {
116 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context."); 116 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context.");
117 return 0; 117 return 0;
118 } 118 }
119 119
120 IDBDatabaseCallbacks* databaseCallbacks = IDBDatabaseCallbacks::create(); 120 IDBDatabaseCallbacks* databaseCallbacks = IDBDatabaseCallbacks::create();
121 int64_t transactionId = IDBDatabase::nextTransactionId(); 121 int64_t transactionId = IDBDatabase::nextTransactionId();
122 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, databaseCa llbacks, transactionId, version); 122 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, databaseCa llbacks, transactionId, version);
123 123
124 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) { 124 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) {
125 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage)); 125 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage));
126 return request; 126 return request;
127 } 127 }
128 128
129 blink::Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::cr eate(databaseCallbacks).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(sc riptState->executionContext()->securityOrigin())); 129 Platform::current()->idbFactory()->open(name, version, transactionId, WebIDB CallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::create(da tabaseCallbacks).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin()));
130 return request; 130 return request;
131 } 131 }
132 132
133 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, ExceptionState& exceptionState) 133 IDBOpenDBRequest* IDBFactory::open(ScriptState* scriptState, const String& name, ExceptionState& exceptionState)
134 { 134 {
135 IDB_TRACE("IDBFactory::open"); 135 IDB_TRACE("IDBFactory::open");
136 return openInternal(scriptState, name, IDBDatabaseMetadata::NoIntVersion, ex ceptionState); 136 return openInternal(scriptState, name, IDBDatabaseMetadata::NoIntVersion, ex ceptionState);
137 } 137 }
138 138
139 IDBOpenDBRequest* IDBFactory::deleteDatabase(ScriptState* scriptState, const Str ing& name, ExceptionState& exceptionState) 139 IDBOpenDBRequest* IDBFactory::deleteDatabase(ScriptState* scriptState, const Str ing& name, ExceptionState& exceptionState)
140 { 140 {
141 IDB_TRACE("IDBFactory::deleteDatabase"); 141 IDB_TRACE("IDBFactory::deleteDatabase");
142 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd APICalls", IDBDeleteDatabaseCall, IDBMethodsMax); 142 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall s", IDBDeleteDatabaseCall, IDBMethodsMax);
143 if (name.isNull()) { 143 if (name.isNull()) {
144 exceptionState.throwTypeError("The name provided must not be empty."); 144 exceptionState.throwTypeError("The name provided must not be empty.");
145 return 0; 145 return 0;
146 } 146 }
147 if (!isContextValid(scriptState->executionContext())) 147 if (!isContextValid(scriptState->executionContext()))
148 return nullptr; 148 return nullptr;
149 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) { 149 if (!scriptState->executionContext()->securityOrigin()->canAccessDatabase()) {
150 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context."); 150 exceptionState.throwSecurityError("access to the Indexed Database API is denied in this context.");
151 return 0; 151 return 0;
152 } 152 }
153 153
154 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, nullptr, 0 , IDBDatabaseMetadata::DefaultIntVersion); 154 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState, nullptr, 0 , IDBDatabaseMetadata::DefaultIntVersion);
155 155
156 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) { 156 if (!m_permissionClient->allowIndexedDB(scriptState->executionContext(), nam e)) {
157 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage)); 157 request->onError(DOMError::create(UnknownError, permissionDeniedErrorMes sage));
158 return request; 158 return request;
159 } 159 }
160 160
161 blink::Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbac ksImpl::create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(sc riptState->executionContext()->securityOrigin())); 161 Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl: :create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(scriptSta te->executionContext()->securityOrigin()));
162 return request; 162 return request;
163 } 163 }
164 164
165 short IDBFactory::cmp(ScriptState* scriptState, const ScriptValue& firstValue, c onst ScriptValue& secondValue, ExceptionState& exceptionState) 165 short IDBFactory::cmp(ScriptState* scriptState, const ScriptValue& firstValue, c onst ScriptValue& secondValue, ExceptionState& exceptionState)
166 { 166 {
167 IDBKey* first = scriptValueToIDBKey(scriptState->isolate(), firstValue); 167 IDBKey* first = scriptValueToIDBKey(scriptState->isolate(), firstValue);
168 IDBKey* second = scriptValueToIDBKey(scriptState->isolate(), secondValue); 168 IDBKey* second = scriptValueToIDBKey(scriptState->isolate(), secondValue);
169 169
170 ASSERT(first); 170 ASSERT(first);
171 ASSERT(second); 171 ASSERT(second);
172 172
173 if (!first->isValid() || !second->isValid()) { 173 if (!first->isValid() || !second->isValid()) {
174 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 174 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
175 return 0; 175 return 0;
176 } 176 }
177 177
178 return static_cast<short>(first->compare(second)); 178 return static_cast<short>(first->compare(second));
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBIndex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698