Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: Source/web/WebSharedWorkerImpl.cpp

Issue 241303002: Rename WebFrameImpl to WebLocalFrameImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Mac too Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebRange.cpp ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "WebSharedWorkerImpl.h" 32 #include "WebSharedWorkerImpl.h"
33 33
34 #include "DatabaseClientImpl.h" 34 #include "DatabaseClientImpl.h"
35 #include "LocalFileSystemClient.h" 35 #include "LocalFileSystemClient.h"
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "WebDataSourceImpl.h" 37 #include "WebDataSourceImpl.h"
38 #include "WebFrame.h" 38 #include "WebFrame.h"
39 #include "WebFrameImpl.h" 39 #include "WebLocalFrameImpl.h"
40 #include "WebSettings.h" 40 #include "WebSettings.h"
41 #include "WebView.h" 41 #include "WebView.h"
42 #include "WorkerPermissionClient.h" 42 #include "WorkerPermissionClient.h"
43 #include "core/dom/CrossThreadTask.h" 43 #include "core/dom/CrossThreadTask.h"
44 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
45 #include "core/events/MessageEvent.h" 45 #include "core/events/MessageEvent.h"
46 #include "core/html/HTMLFormElement.h" 46 #include "core/html/HTMLFormElement.h"
47 #include "core/inspector/InspectorInstrumentation.h" 47 #include "core/inspector/InspectorInstrumentation.h"
48 #include "core/inspector/WorkerDebuggerAgent.h" 48 #include "core/inspector/WorkerDebuggerAgent.h"
49 #include "core/inspector/WorkerInspectorController.h" 49 #include "core/inspector/WorkerInspectorController.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 , m_pauseWorkerContextOnStart(false) 159 , m_pauseWorkerContextOnStart(false)
160 , m_attachDevToolsOnStart(false) 160 , m_attachDevToolsOnStart(false)
161 { 161 {
162 initializeWebKitStaticValues(); 162 initializeWebKitStaticValues();
163 } 163 }
164 164
165 WebSharedWorkerImpl::~WebSharedWorkerImpl() 165 WebSharedWorkerImpl::~WebSharedWorkerImpl()
166 { 166 {
167 ASSERT(m_webView); 167 ASSERT(m_webView);
168 // Detach the client before closing the view to avoid getting called back. 168 // Detach the client before closing the view to avoid getting called back.
169 toWebFrameImpl(m_mainFrame)->setClient(0); 169 toWebLocalFrameImpl(m_mainFrame)->setClient(0);
170 170
171 m_webView->close(); 171 m_webView->close();
172 m_mainFrame->close(); 172 m_mainFrame->close();
173 } 173 }
174 174
175 void WebSharedWorkerImpl::stopWorkerThread() 175 void WebSharedWorkerImpl::stopWorkerThread()
176 { 176 {
177 if (m_askedToTerminate) 177 if (m_askedToTerminate)
178 return; 178 return;
179 m_askedToTerminate = true; 179 m_askedToTerminate = true;
180 if (m_mainScriptLoader) 180 if (m_mainScriptLoader)
181 m_mainScriptLoader->cancel(); 181 m_mainScriptLoader->cancel();
182 if (m_workerThread) 182 if (m_workerThread)
183 m_workerThread->stop(); 183 m_workerThread->stop();
184 } 184 }
185 185
186 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) 186 void WebSharedWorkerImpl::initializeLoader(const WebURL& url)
187 { 187 {
188 // Create 'shadow page'. This page is never displayed, it is used to proxy t he 188 // Create 'shadow page'. This page is never displayed, it is used to proxy t he
189 // loading requests from the worker context to the rest of WebKit and Chromi um 189 // loading requests from the worker context to the rest of WebKit and Chromi um
190 // infrastructure. 190 // infrastructure.
191 ASSERT(!m_webView); 191 ASSERT(!m_webView);
192 m_webView = WebView::create(0); 192 m_webView = WebView::create(0);
193 m_webView->settings()->setOfflineWebApplicationCacheEnabled(RuntimeEnabledFe atures::applicationCacheEnabled()); 193 m_webView->settings()->setOfflineWebApplicationCacheEnabled(RuntimeEnabledFe atures::applicationCacheEnabled());
194 // FIXME: Settings information should be passed to the Worker process from B rowser process when the worker 194 // FIXME: Settings information should be passed to the Worker process from B rowser process when the worker
195 // is created (similar to RenderThread::OnCreateNewView). 195 // is created (similar to RenderThread::OnCreateNewView).
196 m_mainFrame = WebLocalFrame::create(this); 196 m_mainFrame = WebLocalFrame::create(this);
197 m_webView->setMainFrame(m_mainFrame); 197 m_webView->setMainFrame(m_mainFrame);
198 198
199 WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame()); 199 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame());
200 200
201 // Construct substitute data source for the 'shadow page'. We only need it 201 // Construct substitute data source for the 'shadow page'. We only need it
202 // to have same origin as the worker so the loading checks work correctly. 202 // to have same origin as the worker so the loading checks work correctly.
203 CString content(""); 203 CString content("");
204 int length = static_cast<int>(content.length()); 204 int length = static_cast<int>(content.length());
205 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); 205 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length));
206 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(url), S ubstituteData(buffer, "text/html", "UTF-8", KURL()))); 206 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(url), S ubstituteData(buffer, "text/html", "UTF-8", KURL())));
207 } 207 }
208 208
209 WebApplicationCacheHost* WebSharedWorkerImpl::createApplicationCacheHost(WebLoca lFrame*, WebApplicationCacheHostClient* appcacheHostClient) 209 WebApplicationCacheHost* WebSharedWorkerImpl::createApplicationCacheHost(WebLoca lFrame*, WebApplicationCacheHostClient* appcacheHostClient)
210 { 210 {
211 if (client()) 211 if (client())
212 return client()->createApplicationCacheHost(appcacheHostClient); 212 return client()->createApplicationCacheHost(appcacheHostClient);
213 return 0; 213 return 0;
214 } 214 }
215 215
216 void WebSharedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) 216 void WebSharedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame)
217 { 217 {
218 ASSERT(!m_loadingDocument); 218 ASSERT(!m_loadingDocument);
219 ASSERT(!m_mainScriptLoader); 219 ASSERT(!m_mainScriptLoader);
220 m_mainScriptLoader = Loader::create(); 220 m_mainScriptLoader = Loader::create();
221 m_loadingDocument = toWebFrameImpl(frame)->frame()->document(); 221 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document();
222 m_mainScriptLoader->load( 222 m_mainScriptLoader->load(
223 m_loadingDocument.get(), 223 m_loadingDocument.get(),
224 m_url, 224 m_url,
225 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this), 225 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this),
226 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this)); 226 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this));
227 } 227 }
228 228
229 // WorkerReportingProxy -------------------------------------------------------- 229 // WorkerReportingProxy --------------------------------------------------------
230 230
231 void WebSharedWorkerImpl::reportException(const String& errorMessage, int lineNu mber, int columnNumber, const String& sourceURL) 231 void WebSharedWorkerImpl::reportException(const String& errorMessage, int lineNu mber, int columnNumber, const String& sourceURL)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (client()) 283 if (client())
284 client()->workerContextDestroyed(); 284 client()->workerContextDestroyed();
285 // The lifetime of this proxy is controlled by the worker context. 285 // The lifetime of this proxy is controlled by the worker context.
286 delete this; 286 delete this;
287 } 287 }
288 288
289 // WorkerLoaderProxy ----------------------------------------------------------- 289 // WorkerLoaderProxy -----------------------------------------------------------
290 290
291 void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> task ) 291 void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> task )
292 { 292 {
293 toWebFrameImpl(m_mainFrame)->frame()->document()->postTask(task); 293 toWebLocalFrameImpl(m_mainFrame)->frame()->document()->postTask(task);
294 } 294 }
295 295
296 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContex tTask> task) 296 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContex tTask> task)
297 { 297 {
298 m_workerThread->runLoop().postTask(task); 298 m_workerThread->runLoop().postTask(task);
299 return true; 299 return true;
300 } 300 }
301 301
302 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) 302 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel)
303 { 303 {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 workerThread()->runLoop().postDebuggerTask(createCallbackTask(dispatchOnInsp ectorBackendTask, String(message))); 433 workerThread()->runLoop().postDebuggerTask(createCallbackTask(dispatchOnInsp ectorBackendTask, String(message)));
434 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); 434 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread());
435 } 435 }
436 436
437 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 437 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
438 { 438 {
439 return new WebSharedWorkerImpl(client); 439 return new WebSharedWorkerImpl(client);
440 } 440 }
441 441
442 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebRange.cpp ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698