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

Side by Side Diff: Source/WebKit/chromium/src/IDBFactoryBackendProxy.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // but only after the worker run loop stops processing tasks. So even in 147 // but only after the worker run loop stops processing tasks. So even in
148 // the most interleaved case, we have: 148 // the most interleaved case, we have:
149 // W AllowIndexedDBMainThreadBridge schedules allowIndexedDBTask 149 // W AllowIndexedDBMainThreadBridge schedules allowIndexedDBTask
150 // M workerRunLoop marked as killed 150 // M workerRunLoop marked as killed
151 // W runLoop stops and schedules object deletion on main thread 151 // W runLoop stops and schedules object deletion on main thread
152 // M allowIndexedDBTask calls commonClient->allowIndexedDB() 152 // M allowIndexedDBTask calls commonClient->allowIndexedDB()
153 // M WebWorkerBase and WebCommonWorkerClient are deleted 153 // M WebWorkerBase and WebCommonWorkerClient are deleted
154 WebWorkerBase* m_webWorkerBase; 154 WebWorkerBase* m_webWorkerBase;
155 }; 155 };
156 156
157 bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, con st String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callb acks) 157 bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, con st String& name, const WebSecurityOrigin& origin, IDBCallbacks* callbacks)
158 { 158 {
159 bool allowed; 159 bool allowed;
160 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerC ontext()); 160 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerC ontext());
161 if (context->isDocument()) { 161 if (context->isDocument()) {
162 Document* document = static_cast<Document*>(context); 162 Document* document = static_cast<Document*>(context);
163 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 163 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
164 WebViewImpl* webView = webFrame->viewImpl(); 164 WebViewImpl* webView = webFrame->viewImpl();
165 // FIXME: webView->permissionClient() returns 0 in test_shell and conten t_shell http://crbug.com/137269 165 // FIXME: webView->permissionClient() returns 0 in test_shell and conten t_shell http://crbug.com/137269
166 allowed = !webView->permissionClient() || webView->permissionClient()->a llowIndexedDB(webFrame, name, origin); 166 allowed = !webView->permissionClient() || webView->permissionClient()->a llowIndexedDB(webFrame, name, origin);
167 } else { 167 } else {
(...skipping 12 matching lines...) Expand all
180 } 180 }
181 allowed = bridge->result(); 181 allowed = bridge->result();
182 } 182 }
183 183
184 if (!allowed) 184 if (!allowed)
185 callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UnknownErro r, "The user denied permission to access the database.")); 185 callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UnknownErro r, "The user denied permission to access the database."));
186 186
187 return allowed; 187 return allowed;
188 } 188 }
189 189
190 void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallba cks, const String& databaseIdentifier, ScriptExecutionContext* context, const St ring& dataDir) 190 void IDBFactoryBackendProxy::getDatabaseNames(IDBCallbacks* callbacks, const Str ing& databaseIdentifier, ScriptExecutionContext* context, const String& dataDir)
191 { 191 {
192 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
193 WebSecurityOrigin origin(context->securityOrigin()); 192 WebSecurityOrigin origin(context->securityOrigin());
194 if (!allowIndexedDB(context, "Database Listing", origin, callbacks)) 193 if (!allowIndexedDB(context, "Database Listing", origin, callbacks))
195 return; 194 return;
196 195
197 m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), databa seIdentifier, dataDir); 196 m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), databa seIdentifier, dataDir);
198 } 197 }
199 198
200 void IDBFactoryBackendProxy::open(const String& name, int64_t version, int64_t t ransactionId, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallb acks> prpDatabaseCallbacks, const String& databaseIdentifier, ScriptExecutionCon text* context, const String& dataDir) 199 void IDBFactoryBackendProxy::open(const String& name, int64_t version, int64_t t ransactionId, IDBCallbacks* callbacks, IDBDatabaseCallbacks* databaseCallbacks, const String& databaseIdentifier, ScriptExecutionContext* context, const String& dataDir)
201 { 200 {
202 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
203 RefPtr<IDBDatabaseCallbacks> databaseCallbacks(prpDatabaseCallbacks);
204 WebSecurityOrigin origin(context->securityOrigin()); 201 WebSecurityOrigin origin(context->securityOrigin());
205 if (!allowIndexedDB(context, name, origin, callbacks)) 202 if (!allowIndexedDB(context, name, origin, callbacks))
206 return; 203 return;
207 204
208 m_webIDBFactory->open(name, version, transactionId, new WebIDBCallbacksImpl( callbacks), new WebIDBDatabaseCallbacksImpl(databaseCallbacks), databaseIdentifi er, dataDir); 205 m_webIDBFactory->open(name, version, transactionId, new WebIDBCallbacksImpl( callbacks), new WebIDBDatabaseCallbacksImpl(databaseCallbacks), databaseIdentifi er, dataDir);
209 } 206 }
210 207
211 void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCa llbacks> prpCallbacks, const String& databaseIdentifier, ScriptExecutionContext* context, const String& dataDir) 208 void IDBFactoryBackendProxy::deleteDatabase(const String& name, IDBCallbacks* ca llbacks, const String& databaseIdentifier, ScriptExecutionContext* context, cons t String& dataDir)
212 { 209 {
213 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
214 WebSecurityOrigin origin(context->securityOrigin()); 210 WebSecurityOrigin origin(context->securityOrigin());
215 if (!allowIndexedDB(context, name, origin, callbacks)) 211 if (!allowIndexedDB(context, name, origin, callbacks))
216 return; 212 return;
217 213
218 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), da tabaseIdentifier, dataDir); 214 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), da tabaseIdentifier, dataDir);
219 } 215 }
220 216
221 } // namespace WebKit 217 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/IDBFactoryBackendProxy.h ('k') | Source/WebKit/chromium/src/WebIDBCallbacksImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698