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

Side by Side 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, 1 month 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/render_messages.h"
6 #include "chrome/renderer/in_renderer_worker_permission_client_proxy.h"
7 #include "content/public/renderer/render_thread.h"
8 #include "ipc/ipc_sync_message_filter.h"
9 #include "third_party/WebKit/public/web/WebDocument.h"
10 #include "third_party/WebKit/public/web/WebFrame.h"
11 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
12
13 InRendererWorkerPermissionClientProxy::InRendererWorkerPermissionClientProxy(
14 WebKit::WebFrame* frame,
15 int routing_id)
16 : routing_id_(routing_id),
17 is_unique_origin_(false) {
18 if (frame->document().securityOrigin().isUnique() ||
19 frame->top()->document().securityOrigin().isUnique())
20 is_unique_origin_ = true;
21 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.
22 sync_message_filter_ = content::RenderThread::Get()->GetSyncMessageFilter();
23 document_origin_url_ = GURL(frame->document().securityOrigin().toString());
24 top_frame_origin_url_ = GURL(
25 frame->top()->document().securityOrigin().toString());
26 }
27
28 InRendererWorkerPermissionClientProxy::~InRendererWorkerPermissionClientProxy(
29 ) {}
30
31 bool InRendererWorkerPermissionClientProxy::allowDatabase(
32 const WebKit::WebString& name,
33 const WebKit::WebString& display_name,
34 unsigned long estimated_size) {
35 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)
36 return false;
37
38 bool result = false;
39 sync_message_filter_->Send(new ChromeViewHostMsg_AllowDatabase(
40 routing_id_, document_origin_url_, top_frame_origin_url_,
41 name, display_name, &result));
42 return result;
43 }
44
45 bool InRendererWorkerPermissionClientProxy::allowFileSystem() {
46 if (is_unique_origin_ || !sync_message_filter_)
47 return false;
48
49 bool result = false;
50 sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem(
51 routing_id_, document_origin_url_, top_frame_origin_url_, &result));
52 return result;
53 }
54
55 bool InRendererWorkerPermissionClientProxy::allowIndexedDB(
56 const WebKit::WebString& name) {
57 if (is_unique_origin_ || !sync_message_filter_)
58 return false;
59
60 bool result = false;
61 sync_message_filter_->Send(new ChromeViewHostMsg_AllowIndexedDB(
62 routing_id_, document_origin_url_, top_frame_origin_url_, name, &result));
63 return result;
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698