Chromium Code Reviews| Index: chrome/renderer/worker_permission_client_proxy.cc |
| diff --git a/chrome/renderer/worker_permission_client_proxy.cc b/chrome/renderer/worker_permission_client_proxy.cc |
| index 7d8a65e87ea92419838ee79d97a2ed33ebdd0744..0bd969da438168d49b72fe313dab25655b80cd3d 100644 |
| --- a/chrome/renderer/worker_permission_client_proxy.cc |
| +++ b/chrome/renderer/worker_permission_client_proxy.cc |
| @@ -7,6 +7,7 @@ |
| #include "content/public/renderer/render_frame.h" |
| #include "content/public/renderer/render_thread.h" |
| #include "ipc/ipc_sync_message_filter.h" |
| +#include "third_party/WebKit/public/platform/WebPermissionCallbacks.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" |
| @@ -46,11 +47,41 @@ bool WorkerPermissionClientProxy::allowFileSystem() { |
| return false; |
| bool result = false; |
| - sync_message_filter_->Send(new ChromeViewHostMsg_AllowFileSystem( |
| + sync_message_filter_->Send(new ChromeViewHostMsg_RequestFileSystemAccessSync( |
| routing_id_, document_origin_url_, top_frame_origin_url_, &result)); |
| return result; |
| } |
| +bool WorkerPermissionClientProxy::requestFileSystemAccessSync() { |
| + if (is_unique_origin_) |
| + return false; |
| + |
| + bool result = false; |
| + sync_message_filter_->Send(new ChromeViewHostMsg_RequestFileSystemAccessSync( |
| + routing_id_, document_origin_url_, top_frame_origin_url_, &result)); |
| + return result; |
| +} |
| + |
| +void WorkerPermissionClientProxy::requestFileSystemAccessAsync( |
| + const blink::WebPermissionCallbacks& callbacks) { |
| + bool result = false; |
| + |
| + // There are two reasons the we still send a synchronized message here: |
| + // 1. This function is called in blink's worker thread. Therefore, sending |
| + // synchronized message will only block the worker's thread, but won't block |
| + // the main thread of the browser. |
|
Fady Samuel
2014/05/15 16:08:09
the main thread. Remove "of the browser", we are n
Xi Han
2014/05/15 16:19:58
Done.
|
| + // 2. Compare with sending a asynchronized message, reuse sync_message_filter |
|
Fady Samuel
2014/05/15 16:08:09
// 2. The sync filesystem API requires blocking. U
Xi Han
2014/05/15 16:19:58
Thanks for updating the comments.
On 2014/05/15 1
|
| + // will largely reduces the code complexity. |
| + sync_message_filter_->Send(new ChromeViewHostMsg_RequestFileSystemAccessSync( |
| + routing_id_, document_origin_url_, top_frame_origin_url_, &result)); |
| + blink::WebPermissionCallbacks permission_callbacks(callbacks); |
| + if (result) { |
| + permission_callbacks.doAllow(); |
| + return; |
| + } |
| + permission_callbacks.doDeny(); |
| +} |
| + |
| bool WorkerPermissionClientProxy::allowIndexedDB( |
| const blink::WebString& name) { |
| if (is_unique_origin_) |