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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 { | 77 { |
78 return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(contentSettingsC
lient)); | 78 return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(contentSettingsC
lient)); |
79 } | 79 } |
80 | 80 |
81 static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances() | 81 static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances() |
82 { | 82 { |
83 DEFINE_STATIC_LOCAL(HashSet<WebEmbeddedWorkerImpl*>, set, ()); | 83 DEFINE_STATIC_LOCAL(HashSet<WebEmbeddedWorkerImpl*>, set, ()); |
84 return set; | 84 return set; |
85 } | 85 } |
86 | 86 |
87 WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextC
lient> client, PassOwnPtr<WebWorkerContentSettingsClientProxy> ContentSettingsCl
ient) | 87 WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextC
lient> client, PassOwnPtr<WebWorkerContentSettingsClientProxy> contentSettingsCl
ient) |
88 : m_workerContextClient(client) | 88 : m_workerContextClient(std::move(client)) |
89 , m_contentSettingsClient(ContentSettingsClient) | 89 , m_contentSettingsClient(std::move(contentSettingsClient)) |
90 , m_workerInspectorProxy(WorkerInspectorProxy::create()) | 90 , m_workerInspectorProxy(WorkerInspectorProxy::create()) |
91 , m_webView(nullptr) | 91 , m_webView(nullptr) |
92 , m_mainFrame(nullptr) | 92 , m_mainFrame(nullptr) |
93 , m_loadingShadowPage(false) | 93 , m_loadingShadowPage(false) |
94 , m_askedToTerminate(false) | 94 , m_askedToTerminate(false) |
95 , m_pauseAfterDownloadState(DontPauseAfterDownload) | 95 , m_pauseAfterDownloadState(DontPauseAfterDownload) |
96 , m_waitingForDebuggerState(NotWaitingForDebugger) | 96 , m_waitingForDebuggerState(NotWaitingForDebugger) |
97 { | 97 { |
98 runningWorkerInstances().add(this); | 98 runningWorkerInstances().add(this); |
99 } | 99 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 m_mainFrame->frame()->document()->addConsoleMessage(ConsoleMessage::create(O
therMessageSource, webCoreMessageLevel, message.text, message.url, message.lineN
umber, message.columnNumber)); | 229 m_mainFrame->frame()->document()->addConsoleMessage(ConsoleMessage::create(O
therMessageSource, webCoreMessageLevel, message.text, message.url, message.lineN
umber, message.columnNumber)); |
230 } | 230 } |
231 | 231 |
232 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) | 232 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) |
233 { | 233 { |
234 m_workerInspectorProxy->dispatchMessageFromWorker(message); | 234 m_workerInspectorProxy->dispatchMessageFromWorker(message); |
235 } | 235 } |
236 | 236 |
237 void WebEmbeddedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> ta
sk) | 237 void WebEmbeddedWorkerImpl::postTaskToLoader(PassOwnPtr<ExecutionContextTask> ta
sk) |
238 { | 238 { |
239 m_mainFrame->frame()->document()->postTask(BLINK_FROM_HERE, task); | 239 m_mainFrame->frame()->document()->postTask(BLINK_FROM_HERE, std::move(task))
; |
240 } | 240 } |
241 | 241 |
242 bool WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionCont
extTask> task) | 242 bool WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionCont
extTask> task) |
243 { | 243 { |
244 if (m_askedToTerminate || !m_workerThread) | 244 if (m_askedToTerminate || !m_workerThread) |
245 return false; | 245 return false; |
246 | 246 |
247 m_workerThread->postTask(BLINK_FROM_HERE, task); | 247 m_workerThread->postTask(BLINK_FROM_HERE, std::move(task)); |
248 return !m_workerThread->terminated(); | 248 return !m_workerThread->terminated(); |
249 } | 249 } |
250 | 250 |
251 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() | 251 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() |
252 { | 252 { |
253 // Create 'shadow page', which is never displayed and is used mainly to | 253 // Create 'shadow page', which is never displayed and is used mainly to |
254 // provide a context for loading on the main thread. | 254 // provide a context for loading on the main thread. |
255 // | 255 // |
256 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. | 256 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. |
257 // This code, and probably most of the code in this class should be shared | 257 // This code, and probably most of the code in this class should be shared |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 m_mainScriptLoader.clear(); | 401 m_mainScriptLoader.clear(); |
402 | 402 |
403 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 403 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
404 m_loaderProxy = WorkerLoaderProxy::create(this); | 404 m_loaderProxy = WorkerLoaderProxy::create(this); |
405 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 405 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
406 m_workerThread->start(startupData.release()); | 406 m_workerThread->start(startupData.release()); |
407 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 407 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
408 } | 408 } |
409 | 409 |
410 } // namespace blink | 410 } // namespace blink |
OLD | NEW |