| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Construct substitute data source for the 'shadow page'. We only need it | 166 // 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. | 167 // to have same origin as the worker so the loading checks work correctly. |
| 168 CString content(""); | 168 CString content(""); |
| 169 RefPtr<SharedBuffer> buffer( | 169 RefPtr<SharedBuffer> buffer( |
| 170 SharedBuffer::Create(content.data(), content.length())); | 170 SharedBuffer::Create(content.data(), content.length())); |
| 171 main_frame_->GetFrame()->Loader().Load( | 171 main_frame_->GetFrame()->Loader().Load( |
| 172 FrameLoadRequest(0, ResourceRequest(url_), | 172 FrameLoadRequest(0, ResourceRequest(url_), |
| 173 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 173 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void WebSharedWorkerImpl::FrameDetached(WebLocalFrame* frame, DetachType type) { |
| 177 DCHECK(type == DetachType::kRemove && frame->Parent()); |
| 178 DCHECK(frame->FrameWidget()); |
| 179 |
| 180 frame->Close(); |
| 181 } |
| 182 |
| 176 void WebSharedWorkerImpl::DidFinishDocumentLoad() { | 183 void WebSharedWorkerImpl::DidFinishDocumentLoad() { |
| 177 DCHECK(IsMainThread()); | 184 DCHECK(IsMainThread()); |
| 178 DCHECK(!loading_document_); | 185 DCHECK(!loading_document_); |
| 179 DCHECK(!main_script_loader_); | 186 DCHECK(!main_script_loader_); |
| 180 main_frame_->DataSource()->SetServiceWorkerNetworkProvider( | 187 main_frame_->DataSource()->SetServiceWorkerNetworkProvider( |
| 181 client_->CreateServiceWorkerNetworkProvider()); | 188 client_->CreateServiceWorkerNetworkProvider()); |
| 182 main_script_loader_ = WorkerScriptLoader::Create(); | 189 main_script_loader_ = WorkerScriptLoader::Create(); |
| 183 main_script_loader_->SetRequestContext( | 190 main_script_loader_->SetRequestContext( |
| 184 WebURLRequest::kRequestContextSharedWorker); | 191 WebURLRequest::kRequestContextSharedWorker); |
| 185 loading_document_ = main_frame_->GetFrame()->GetDocument(); | 192 loading_document_ = main_frame_->GetFrame()->GetDocument(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (devtools_agent) | 435 if (devtools_agent) |
| 429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 436 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
| 430 message); | 437 message); |
| 431 } | 438 } |
| 432 | 439 |
| 433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 440 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
| 434 return new WebSharedWorkerImpl(client); | 441 return new WebSharedWorkerImpl(client); |
| 435 } | 442 } |
| 436 | 443 |
| 437 } // namespace blink | 444 } // namespace blink |
| OLD | NEW |