Chromium Code Reviews| Index: content/browser/shared_worker/shared_worker_message_filter.cc |
| diff --git a/content/browser/shared_worker/shared_worker_message_filter.cc b/content/browser/shared_worker/shared_worker_message_filter.cc |
| index fd306ac47e5da613ce60c6098b3f1b62bb5be250..2a1edf5dd53607818b7c0685fea70ed89c349e32 100644 |
| --- a/content/browser/shared_worker/shared_worker_message_filter.cc |
| +++ b/content/browser/shared_worker/shared_worker_message_filter.cc |
| @@ -12,6 +12,7 @@ |
| #include "content/common/devtools_messages.h" |
| #include "content/common/view_messages.h" |
| #include "content/common/worker_messages.h" |
| +#include "content/public/browser/browser_thread.h" |
| #include "third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h" |
| namespace content { |
| @@ -39,12 +40,11 @@ SharedWorkerMessageFilter::SharedWorkerMessageFilter( |
| arraysize(kFilteredMessageClasses)), |
| render_process_id_(render_process_id), |
| resource_context_(resource_context), |
| - partition_(partition), |
| + partition_id_(WorkerStoragePartitionId(partition)), |
| message_port_message_filter_(message_port_message_filter) { |
| } |
| SharedWorkerMessageFilter::~SharedWorkerMessageFilter() { |
| - DCHECK_CURRENTLY_ON(BrowserThread::IO); |
|
nhiroki
2016/08/17 06:58:04
Why did you remove this?
horo
2016/08/17 07:15:54
SharedWorkerMessageFilter may be deleted on UI thr
|
| } |
| void SharedWorkerMessageFilter::OnChannelClosing() { |
| @@ -86,13 +86,23 @@ int SharedWorkerMessageFilter::GetNextRoutingID() { |
| return message_port_message_filter_->GetNextRoutingID(); |
| } |
| +void SharedWorkerMessageFilter::DetachAllDocument() { |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
| + base::Bind(&SharedWorkerMessageFilter::DetachAllDocument, this)); |
| + return; |
| + } |
| + SharedWorkerServiceImpl::GetInstance()->DetachAllDocument(this); |
| +} |
| + |
| void SharedWorkerMessageFilter::OnCreateWorker( |
| const ViewHostMsg_CreateWorker_Params& params, |
| ViewHostMsg_CreateWorker_Reply* reply) { |
| reply->route_id = GetNextRoutingID(); |
| reply->error = SharedWorkerServiceImpl::GetInstance()->CreateWorker( |
| params, reply->route_id, this, resource_context_, |
| - WorkerStoragePartitionId(partition_)); |
| + partition_id_); |
| if (CreateWorkerErrorIsFatal(reply->error)) |
| reply->route_id = MSG_ROUTING_NONE; |
| } |