Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "platform/wtf/PtrUtil.h" | 64 #include "platform/wtf/PtrUtil.h" |
| 65 #include "public/platform/Platform.h" | 65 #include "public/platform/Platform.h" |
| 66 #include "public/platform/WebMessagePortChannel.h" | 66 #include "public/platform/WebMessagePortChannel.h" |
| 67 #include "public/platform/WebString.h" | 67 #include "public/platform/WebString.h" |
| 68 #include "public/platform/WebURL.h" | 68 #include "public/platform/WebURL.h" |
| 69 #include "public/platform/WebURLRequest.h" | 69 #include "public/platform/WebURLRequest.h" |
| 70 #include "public/platform/WebWorkerFetchContext.h" | 70 #include "public/platform/WebWorkerFetchContext.h" |
| 71 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" | 71 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" |
| 72 #include "public/web/WebDevToolsAgent.h" | 72 #include "public/web/WebDevToolsAgent.h" |
| 73 #include "public/web/WebFrame.h" | 73 #include "public/web/WebFrame.h" |
| 74 #include "public/web/WebFrameWidget.h" | |
| 74 #include "public/web/WebSettings.h" | 75 #include "public/web/WebSettings.h" |
| 75 #include "public/web/WebView.h" | 76 #include "public/web/WebView.h" |
| 76 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 77 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 77 #include "web/IndexedDBClientImpl.h" | 78 #include "web/IndexedDBClientImpl.h" |
| 78 #include "web/LocalFileSystemClient.h" | 79 #include "web/LocalFileSystemClient.h" |
| 79 | 80 |
| 80 namespace blink { | 81 namespace blink { |
| 81 | 82 |
| 82 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as | 83 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as |
| 83 // possible. | 84 // possible. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 // Construct substitute data source for the 'shadow page'. We only need it | 167 // Construct substitute data source for the 'shadow page'. We only need it |
| 167 // to have same origin as the worker so the loading checks work correctly. | 168 // to have same origin as the worker so the loading checks work correctly. |
| 168 CString content(""); | 169 CString content(""); |
| 169 RefPtr<SharedBuffer> buffer( | 170 RefPtr<SharedBuffer> buffer( |
| 170 SharedBuffer::Create(content.data(), content.length())); | 171 SharedBuffer::Create(content.data(), content.length())); |
| 171 main_frame_->GetFrame()->Loader().Load( | 172 main_frame_->GetFrame()->Loader().Load( |
| 172 FrameLoadRequest(0, ResourceRequest(url_), | 173 FrameLoadRequest(0, ResourceRequest(url_), |
| 173 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 174 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
| 174 } | 175 } |
| 175 | 176 |
| 177 void WebSharedWorkerImpl::FrameDetached(WebLocalFrame* frame, DetachType type) { | |
| 178 if (type == DetachType::kRemove && frame->Parent()) | |
|
kinuko
2017/05/15 06:27:16
Can we also just DCHECK here as we do in WebEmbedd
| |
| 179 frame->Parent()->RemoveChild(frame); | |
| 180 | |
| 181 if (frame->FrameWidget()) | |
| 182 frame->FrameWidget()->Close(); | |
| 183 | |
| 184 frame->Close(); | |
| 185 } | |
| 186 | |
| 176 void WebSharedWorkerImpl::DidFinishDocumentLoad() { | 187 void WebSharedWorkerImpl::DidFinishDocumentLoad() { |
| 177 DCHECK(IsMainThread()); | 188 DCHECK(IsMainThread()); |
| 178 DCHECK(!loading_document_); | 189 DCHECK(!loading_document_); |
| 179 DCHECK(!main_script_loader_); | 190 DCHECK(!main_script_loader_); |
| 180 main_frame_->DataSource()->SetServiceWorkerNetworkProvider( | 191 main_frame_->DataSource()->SetServiceWorkerNetworkProvider( |
| 181 client_->CreateServiceWorkerNetworkProvider()); | 192 client_->CreateServiceWorkerNetworkProvider()); |
| 182 main_script_loader_ = WorkerScriptLoader::Create(); | 193 main_script_loader_ = WorkerScriptLoader::Create(); |
| 183 main_script_loader_->SetRequestContext( | 194 main_script_loader_->SetRequestContext( |
| 184 WebURLRequest::kRequestContextSharedWorker); | 195 WebURLRequest::kRequestContextSharedWorker); |
| 185 loading_document_ = main_frame_->GetFrame()->GetDocument(); | 196 loading_document_ = main_frame_->GetFrame()->GetDocument(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 if (devtools_agent) | 439 if (devtools_agent) |
| 429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 440 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
| 430 message); | 441 message); |
| 431 } | 442 } |
| 432 | 443 |
| 433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 444 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
| 434 return new WebSharedWorkerImpl(client); | 445 return new WebSharedWorkerImpl(client); |
| 435 } | 446 } |
| 436 | 447 |
| 437 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |