| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 , m_askedToTerminate(false) | 95 , m_askedToTerminate(false) |
| 96 , m_client(client) | 96 , m_client(client) |
| 97 , m_pauseWorkerContextOnStart(false) | 97 , m_pauseWorkerContextOnStart(false) |
| 98 { | 98 { |
| 99 initializeWebKitStaticValues(); | 99 initializeWebKitStaticValues(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 WebSharedWorkerImpl::~WebSharedWorkerImpl() | 102 WebSharedWorkerImpl::~WebSharedWorkerImpl() |
| 103 { | 103 { |
| 104 ASSERT(m_webView); | 104 ASSERT(m_webView); |
| 105 WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 105 WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame()); |
| 106 if (webFrame) | 106 if (webFrame) |
| 107 webFrame->setClient(0); | 107 webFrame->setClient(0); |
| 108 m_webView->close(); | 108 m_webView->close(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void WebSharedWorkerImpl::stopWorkerThread() | 111 void WebSharedWorkerImpl::stopWorkerThread() |
| 112 { | 112 { |
| 113 if (m_askedToTerminate) | 113 if (m_askedToTerminate) |
| 114 return; | 114 return; |
| 115 m_askedToTerminate = true; | 115 m_askedToTerminate = true; |
| 116 if (m_workerThread) | 116 if (m_workerThread) |
| 117 m_workerThread->stop(); | 117 m_workerThread->stop(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) | 120 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) |
| 121 { | 121 { |
| 122 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he | 122 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he |
| 123 // loading requests from the worker context to the rest of WebKit and Chromi
um | 123 // loading requests from the worker context to the rest of WebKit and Chromi
um |
| 124 // infrastructure. | 124 // infrastructure. |
| 125 ASSERT(!m_webView); | 125 ASSERT(!m_webView); |
| 126 m_webView = WebView::create(0); | 126 m_webView = WebView::create(0); |
| 127 m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatur
es::isApplicationCacheEnabled()); | 127 m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatur
es::isApplicationCacheEnabled()); |
| 128 // FIXME: Settings information should be passed to the Worker process from B
rowser process when the worker | 128 // FIXME: Settings information should be passed to the Worker process from B
rowser process when the worker |
| 129 // is created (similar to RenderThread::OnCreateNewView). | 129 // is created (similar to RenderThread::OnCreateNewView). |
| 130 m_webView->initializeMainFrame(this); | 130 m_webView->initializeMainFrame(this); |
| 131 | 131 |
| 132 WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); | 132 WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame()); |
| 133 | 133 |
| 134 // Construct substitute data source for the 'shadow page'. We only need it | 134 // Construct substitute data source for the 'shadow page'. We only need it |
| 135 // to have same origin as the worker so the loading checks work correctly. | 135 // to have same origin as the worker so the loading checks work correctly. |
| 136 CString content(""); | 136 CString content(""); |
| 137 int length = static_cast<int>(content.length()); | 137 int length = static_cast<int>(content.length()); |
| 138 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); | 138 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); |
| 139 webFrame->frame()->loader()->load(FrameLoadRequest(0, ResourceRequest(url),
SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 139 webFrame->frame()->loader()->load(FrameLoadRequest(0, ResourceRequest(url),
SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
| 140 | 140 |
| 141 // This document will be used as 'loading context' for the worker. | 141 // This document will be used as 'loading context' for the worker. |
| 142 m_loadingDocument = webFrame->frame()->document(); | 142 m_loadingDocument = webFrame->frame()->document(); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 workerThread()->runLoop().postTaskForMode(createCallbackTask(dispatchOnInspe
ctorBackendTask, String(message)), WorkerDebuggerAgent::debuggerTaskMode); | 448 workerThread()->runLoop().postTaskForMode(createCallbackTask(dispatchOnInspe
ctorBackendTask, String(message)), WorkerDebuggerAgent::debuggerTaskMode); |
| 449 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); | 449 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); |
| 450 } | 450 } |
| 451 | 451 |
| 452 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 452 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 453 { | 453 { |
| 454 return new WebSharedWorkerImpl(client); | 454 return new WebSharedWorkerImpl(client); |
| 455 } | 455 } |
| 456 | 456 |
| 457 } // namespace WebKit | 457 } // namespace WebKit |
| OLD | NEW |