| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 // Construct substitute data source for the 'shadow page'. We only need it | 200 // Construct substitute data source for the 'shadow page'. We only need it |
| 201 // to have same origin as the worker so the loading checks work correctly. | 201 // to have same origin as the worker so the loading checks work correctly. |
| 202 CString content(""); | 202 CString content(""); |
| 203 int length = static_cast<int>(content.length()); | 203 int length = static_cast<int>(content.length()); |
| 204 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); | 204 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); |
| 205 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(m_worke
rStartData.scriptURL), SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 205 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(m_worke
rStartData.scriptURL), SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void WebEmbeddedWorkerImpl::willSendRequest( | 208 void WebEmbeddedWorkerImpl::willSendRequest( |
| 209 WebFrame* frame, unsigned, WebURLRequest& request, | 209 WebLocalFrame* frame, unsigned, WebURLRequest& request, |
| 210 const WebURLResponse& redirectResponse) | 210 const WebURLResponse& redirectResponse) |
| 211 { | 211 { |
| 212 if (m_networkProvider) | 212 if (m_networkProvider) |
| 213 m_networkProvider->willSendRequest(frame->dataSource(), request); | 213 m_networkProvider->willSendRequest(frame->dataSource(), request); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebFrame* frame) | 216 void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) |
| 217 { | 217 { |
| 218 ASSERT(!m_mainScriptLoader); | 218 ASSERT(!m_mainScriptLoader); |
| 219 ASSERT(!m_networkProvider); | 219 ASSERT(!m_networkProvider); |
| 220 ASSERT(m_mainFrame); | 220 ASSERT(m_mainFrame); |
| 221 ASSERT(m_workerContextClient); | 221 ASSERT(m_workerContextClient); |
| 222 m_networkProvider = adoptPtr(m_workerContextClient->createServiceWorkerNetwo
rkProvider(frame->dataSource())); | 222 m_networkProvider = adoptPtr(m_workerContextClient->createServiceWorkerNetwo
rkProvider(frame->dataSource())); |
| 223 m_mainScriptLoader = Loader::create(); | 223 m_mainScriptLoader = Loader::create(); |
| 224 m_mainScriptLoader->load( | 224 m_mainScriptLoader->load( |
| 225 toWebFrameImpl(m_mainFrame)->frame()->document(), | 225 toWebFrameImpl(m_mainFrame)->frame()->document(), |
| 226 m_workerStartData.scriptURL, | 226 m_workerStartData.scriptURL, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 m_mainScriptLoader.clear(); | 264 m_mainScriptLoader.clear(); |
| 265 | 265 |
| 266 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); | 266 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); |
| 267 m_loaderProxy = LoaderProxy::create(*this); | 267 m_loaderProxy = LoaderProxy::create(*this); |
| 268 | 268 |
| 269 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); | 269 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); |
| 270 m_workerThread->start(); | 270 m_workerThread->start(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace blink | 273 } // namespace blink |
| OLD | NEW |