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

Unified Diff: Source/web/DatabaseObserver.cpp

Issue 50773002: Introduce WebWorkerPermissionClientProxy to deprecate WorkerAllowMainThreadBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated comments, minor code fix Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/IDBFactoryBackendProxy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/DatabaseObserver.cpp
diff --git a/Source/web/DatabaseObserver.cpp b/Source/web/DatabaseObserver.cpp
index 8fe27985f99f2449331e78d4880e4400599c53ad..2480cee9d6ba423dfc3671a333007693147383c4 100644
--- a/Source/web/DatabaseObserver.cpp
+++ b/Source/web/DatabaseObserver.cpp
@@ -41,6 +41,7 @@
#include "WebViewImpl.h"
#include "WebWorkerBase.h"
#include "WorkerAllowMainThreadBridgeBase.h"
+#include "WorkerPermissionClient.h"
#include "bindings/v8/WorkerScriptController.h"
#include "core/dom/CrossThreadTask.h"
#include "core/dom/Document.h"
@@ -58,6 +59,7 @@ namespace {
static const char allowDatabaseMode[] = "allowDatabaseMode";
+// FIXME: Deprecate this.
// This class is used to route the result of the WebWorkerBase::allowDatabase
// call back to the worker context.
class AllowDatabaseMainThreadBridge : public WorkerAllowMainThreadBridgeBase {
@@ -144,6 +146,12 @@ bool DatabaseObserver::canEstablishDatabase(ExecutionContext* executionContext,
return webView->permissionClient()->allowDatabase(webFrame, name, displayName, estimatedSize);
} else {
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(executionContext);
+ WorkerPermissionClient* permissionClient = WorkerPermissionClient::from(workerGlobalScope);
+ if (permissionClient->proxy())
+ return permissionClient->allowDatabase(name, displayName, estimatedSize);
+
+ // FIXME: Deprecate this bridge code when PermissionClientProxy is
+ // implemented by the embedder.
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope->thread()->workerLoaderProxy().toWebWorkerBase());
WebView* view = webWorker->view();
if (!view)
« no previous file with comments | « no previous file | Source/web/IDBFactoryBackendProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698