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

Unified Diff: chrome/renderer/in_renderer_worker_permission_client_proxy.cc

Issue 46583005: Send Allow{Database,FileSystem,IndexedDB} sync IPCs directly from worker thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/renderer/in_renderer_worker_permission_client_proxy.cc
diff --git a/chrome/renderer/in_renderer_worker_permission_client_proxy.cc b/chrome/renderer/in_renderer_worker_permission_client_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5179bda4fd0cd2a1bc595f693ee40aa8b99d1aaf
--- /dev/null
+++ b/chrome/renderer/in_renderer_worker_permission_client_proxy.cc
@@ -0,0 +1,64 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/render_messages.h"
+#include "chrome/renderer/in_renderer_worker_permission_client_proxy.h"
+#include "content/public/renderer/render_thread.h"
+#include "ipc/ipc_sync_message_filter.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
+
+InRendererWorkerPermissionClientProxy::InRendererWorkerPermissionClientProxy(
+ WebKit::WebFrame* frame,
+ int routing_id)
+ : routing_id_(routing_id),
+ is_unique_origin_(false) {
+ if (frame->document().securityOrigin().isUnique() ||
+ frame->top()->document().securityOrigin().isUnique())
+ is_unique_origin_ = true;
+ DCHECK(content::RenderThread::Get());
jam 2013/10/29 17:19:57 nit: this isn't very useful, since in release buil
kinuko 2013/10/30 00:24:56 Removed.
+ sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter();
+ document_origin_url_ = GURL(frame->document().securityOrigin().toString());
+ top_frame_origin_url_ = GURL(
+ frame->top()->document().securityOrigin().toString());
+}
+
+InRendererWorkerPermissionClientProxy::~InRendererWorkerPermissionClientProxy(
+ ) {}
+
+bool InRendererWorkerPermissionClientProxy::allowDatabase(
+ const WebKit::WebString& name,
+ const WebKit::WebString& display_name,
+ unsigned long estimated_size) {
+ if (is_unique_origin_ || !sync_message_filter_)
jam 2013/10/29 17:19:57 nit: here and below, why is there the !sync_messag
kinuko 2013/10/30 00:24:56 Removed the check (here and below)
+ return false;
+
+ bool result = false;
+ sync_message_filter_->Send(new ChromeViewHostMsg_AllowDatabase(
+ routing_id_, document_origin_url_, top_frame_origin_url_,
+ name, display_name, &result));
+ return result;
+}
+
+bool InRendererWorkerPermissionClientProxy::allowFileSystem() {
+ if (is_unique_origin_ || !sync_message_filter_)
+ return false;
+
+ bool result = false;
+ sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem(
+ routing_id_, document_origin_url_, top_frame_origin_url_, &result));
+ return result;
+}
+
+bool InRendererWorkerPermissionClientProxy::allowIndexedDB(
+ const WebKit::WebString& name) {
+ if (is_unique_origin_ || !sync_message_filter_)
+ return false;
+
+ bool result = false;
+ sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB(
+ routing_id_, document_origin_url_, top_frame_origin_url_, name, &result));
+ return result;
+}

Powered by Google App Engine
This is Rietveld 408576698