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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "public/web/WebSettings.h" 65 #include "public/web/WebSettings.h"
66 #include "public/web/WebView.h" 66 #include "public/web/WebView.h"
67 #include "public/web/WebWorkerContentSettingsClientProxy.h" 67 #include "public/web/WebWorkerContentSettingsClientProxy.h"
68 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" 68 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
69 #include "web/IndexedDBClientImpl.h" 69 #include "web/IndexedDBClientImpl.h"
70 #include "web/LocalFileSystemClient.h" 70 #include "web/LocalFileSystemClient.h"
71 #include "web/WebDataSourceImpl.h" 71 #include "web/WebDataSourceImpl.h"
72 #include "web/WebLocalFrameImpl.h" 72 #include "web/WebLocalFrameImpl.h"
73 #include "web/WorkerContentSettingsClient.h" 73 #include "web/WorkerContentSettingsClient.h"
74 #include "wtf/Functional.h" 74 #include "wtf/Functional.h"
75 #include "wtf/PtrUtil.h"
76 #include <memory>
77 75
78 namespace blink { 76 namespace blink {
79 77
80 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as 78 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as
81 // possible. 79 // possible.
82 80
83 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) 81 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client)
84 : m_webView(nullptr) 82 : m_webView(nullptr)
85 , m_mainFrame(nullptr) 83 , m_mainFrame(nullptr)
86 , m_askedToTerminate(false) 84 , m_askedToTerminate(false)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const WebURLResponse& redirectResponse) 163 const WebURLResponse& redirectResponse)
166 { 164 {
167 if (m_networkProvider) 165 if (m_networkProvider)
168 m_networkProvider->willSendRequest(frame->dataSource(), request); 166 m_networkProvider->willSendRequest(frame->dataSource(), request);
169 } 167 }
170 168
171 void WebSharedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) 169 void WebSharedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame)
172 { 170 {
173 DCHECK(!m_loadingDocument); 171 DCHECK(!m_loadingDocument);
174 DCHECK(!m_mainScriptLoader); 172 DCHECK(!m_mainScriptLoader);
175 m_networkProvider = wrapUnique(m_client->createServiceWorkerNetworkProvider( frame->dataSource())); 173 m_networkProvider = adoptPtr(m_client->createServiceWorkerNetworkProvider(fr ame->dataSource()));
176 m_mainScriptLoader = WorkerScriptLoader::create(); 174 m_mainScriptLoader = WorkerScriptLoader::create();
177 m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWor ker); 175 m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWor ker);
178 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document(); 176 m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document();
179 m_mainScriptLoader->loadAsynchronously( 177 m_mainScriptLoader->loadAsynchronously(
180 *m_loadingDocument.get(), 178 *m_loadingDocument.get(),
181 m_url, 179 m_url,
182 DenyCrossOriginRequests, 180 DenyCrossOriginRequests,
183 m_creationAddressSpace, 181 m_creationAddressSpace,
184 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this), 182 bind(&WebSharedWorkerImpl::didReceiveScriptLoaderResponse, this),
185 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this)); 183 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this));
(...skipping 26 matching lines...) Expand all
212 loadShadowPage(); 210 loadShadowPage();
213 } 211 }
214 212
215 WebDevToolsAgentClient::WebKitClientMessageLoop* WebSharedWorkerImpl::createClie ntMessageLoop() 213 WebDevToolsAgentClient::WebKitClientMessageLoop* WebSharedWorkerImpl::createClie ntMessageLoop()
216 { 214 {
217 return m_client->createDevToolsMessageLoop(); 215 return m_client->createDevToolsMessageLoop();
218 } 216 }
219 217
220 // WorkerReportingProxy -------------------------------------------------------- 218 // WorkerReportingProxy --------------------------------------------------------
221 219
222 void WebSharedWorkerImpl::reportException(const String& errorMessage, std::uniqu e_ptr<SourceLocation>) 220 void WebSharedWorkerImpl::reportException(const String& errorMessage, PassOwnPtr <SourceLocation>)
223 { 221 {
224 // Not suppported in SharedWorker. 222 // Not suppported in SharedWorker.
225 } 223 }
226 224
227 void WebSharedWorkerImpl::reportConsoleMessage(ConsoleMessage*) 225 void WebSharedWorkerImpl::reportConsoleMessage(ConsoleMessage*)
228 { 226 {
229 // Not supported in SharedWorker. 227 // Not supported in SharedWorker.
230 } 228 }
231 229
232 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) 230 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return; 324 return;
327 } 325 }
328 326
329 Document* document = m_mainFrame->frame()->document(); 327 Document* document = m_mainFrame->frame()->document();
330 // FIXME: this document's origin is pristine and without any extra privilege s. (crbug.com/254993) 328 // FIXME: this document's origin is pristine and without any extra privilege s. (crbug.com/254993)
331 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); 329 SecurityOrigin* starterOrigin = document->getSecurityOrigin();
332 330
333 WorkerClients* workerClients = WorkerClients::create(); 331 WorkerClients* workerClients = WorkerClients::create();
334 provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create( )); 332 provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create( ));
335 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin()); 333 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin());
336 provideContentSettingsClientToWorker(workerClients, wrapUnique(m_client->cre ateWorkerContentSettingsClientProxy(webSecurityOrigin))); 334 provideContentSettingsClientToWorker(workerClients, adoptPtr(m_client->creat eWorkerContentSettingsClientProxy(webSecurityOrigin)));
337 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()) ; 335 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()) ;
338 ContentSecurityPolicy* contentSecurityPolicy = m_mainScriptLoader->releaseCo ntentSecurityPolicy(); 336 ContentSecurityPolicy* contentSecurityPolicy = m_mainScriptLoader->releaseCo ntentSecurityPolicy();
339 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do cument); 337 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do cument);
340 std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupDa ta::create( 338 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat e(
341 m_url, 339 m_url,
342 m_loadingDocument->userAgent(), 340 m_loadingDocument->userAgent(),
343 m_mainScriptLoader->script(), 341 m_mainScriptLoader->script(),
344 nullptr, 342 nullptr,
345 startMode, 343 startMode,
346 contentSecurityPolicy ? contentSecurityPolicy->headers().get() : nullptr , 344 contentSecurityPolicy ? contentSecurityPolicy->headers().get() : nullptr ,
347 starterOrigin, 345 starterOrigin,
348 workerClients, 346 workerClients,
349 m_mainScriptLoader->responseAddressSpace(), 347 m_mainScriptLoader->responseAddressSpace(),
350 m_mainScriptLoader->originTrialTokens()); 348 m_mainScriptLoader->originTrialTokens());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (devtoolsAgent) 396 if (devtoolsAgent)
399 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes sage); 397 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes sage);
400 } 398 }
401 399
402 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 400 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
403 { 401 {
404 return new WebSharedWorkerImpl(client); 402 return new WebSharedWorkerImpl(client);
405 } 403 }
406 404
407 } // namespace blink 405 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698