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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 } | 149 } |
| 150 | 150 |
| 151 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) | 151 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) |
| 152 : m_webView(0) | 152 : m_webView(0) |
| 153 , m_mainFrame(0) | 153 , m_mainFrame(0) |
| 154 , m_askedToTerminate(false) | 154 , m_askedToTerminate(false) |
| 155 , m_client(WeakReference<WebSharedWorkerClient>::create(client)) | 155 , m_client(WeakReference<WebSharedWorkerClient>::create(client)) |
| 156 , m_clientWeakPtr(WeakPtr<WebSharedWorkerClient>(m_client)) | 156 , m_clientWeakPtr(WeakPtr<WebSharedWorkerClient>(m_client)) |
| 157 , m_pauseWorkerContextOnStart(false) | 157 , m_pauseWorkerContextOnStart(false) |
| 158 , m_attachDevToolsOnStart(false) | 158 , m_attachDevToolsOnStart(false) |
| 159 , m_settings(adoptPtr(new WebWorkerSettingsImpl())) | |
| 159 { | 160 { |
| 160 initializeWebKitStaticValues(); | 161 initializeWebKitStaticValues(); |
| 161 } | 162 } |
| 162 | 163 |
| 163 WebSharedWorkerImpl::~WebSharedWorkerImpl() | 164 WebSharedWorkerImpl::~WebSharedWorkerImpl() |
| 164 { | 165 { |
| 165 ASSERT(m_webView); | 166 ASSERT(m_webView); |
| 166 // Detach the client before closing the view to avoid getting called back. | 167 // Detach the client before closing the view to avoid getting called back. |
| 167 toWebFrameImpl(m_mainFrame)->setClient(0); | 168 toWebFrameImpl(m_mainFrame)->setClient(0); |
| 168 | 169 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 if (client()) | 344 if (client()) |
| 344 client()->workerScriptLoadFailed(); | 345 client()->workerScriptLoadFailed(); |
| 345 return; | 346 return; |
| 346 } | 347 } |
| 347 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; | 348 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |
| 348 OwnPtr<WorkerClients> workerClients = WorkerClients::create(); | 349 OwnPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 349 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c reate()); | 350 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c reate()); |
| 350 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat e()); | 351 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat e()); |
| 351 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); | 352 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); |
| 352 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea teWorkerPermissionClientProxy(webSecurityOrigin))); | 353 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea teWorkerPermissionClientProxy(webSecurityOrigin))); |
| 353 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat e(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->script(), star tMode, m_contentSecurityPolicy, static_cast<WebCore::ContentSecurityPolicy::Head erType>(m_policyType), workerClients.release()); | 354 OwnPtr<WorkerSettings> settings = WorkerSettings::create(); |
| 355 settings->setMemoryInfoEnabled(m_settings->memoryInfoEnabled()); | |
|
kinuko
2014/03/04 04:34:35
As I commented in the other file I prefer having t
Pan
2014/03/06 08:50:56
thanks! done
| |
| 356 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat e(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->script(), star tMode, m_contentSecurityPolicy, static_cast<WebCore::ContentSecurityPolicy::Head erType>(m_policyType), workerClients.release(), settings.release()); | |
| 357 | |
| 354 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData .release())); | 358 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData .release())); |
| 355 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri ptLoader->identifier(), m_mainScriptLoader->script()); | 359 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri ptLoader->identifier(), m_mainScriptLoader->script()); |
| 356 m_mainScriptLoader.clear(); | 360 m_mainScriptLoader.clear(); |
| 357 | 361 |
| 358 if (m_attachDevToolsOnStart) | 362 if (m_attachDevToolsOnStart) |
| 359 workerThread()->runLoop().postDebuggerTask(createCallbackTask(connectToW orkerContextInspectorTask, true)); | 363 workerThread()->runLoop().postDebuggerTask(createCallbackTask(connectToW orkerContextInspectorTask, true)); |
| 360 | 364 |
| 361 workerThread()->start(); | 365 workerThread()->start(); |
| 362 if (client()) | 366 if (client()) |
| 363 client()->workerScriptLoaded(); | 367 client()->workerScriptLoaded(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 workerThread()->runLoop().postDebuggerTask(createCallbackTask(dispatchOnInsp ectorBackendTask, String(message))); | 435 workerThread()->runLoop().postDebuggerTask(createCallbackTask(dispatchOnInsp ectorBackendTask, String(message))); |
| 432 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); | 436 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); |
| 433 } | 437 } |
| 434 | 438 |
| 435 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 439 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 436 { | 440 { |
| 437 return new WebSharedWorkerImpl(client); | 441 return new WebSharedWorkerImpl(client); |
| 438 } | 442 } |
| 439 | 443 |
| 440 } // namespace blink | 444 } // namespace blink |
| OLD | NEW |