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

Side by Side Diff: third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp

Issue 2171563002: Add WorkerSettings to expose certain flag values in WorkerGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 4 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return; 111 return;
112 } 112 }
113 113
114 Document* document = toDocument(getExecutionContext()); 114 Document* document = toDocument(getExecutionContext());
115 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); 115 SecurityOrigin* starterOrigin = document->getSecurityOrigin();
116 116
117 ContentSecurityPolicy* csp = m_workerObject->contentSecurityPolicy() ? m_wor kerObject->contentSecurityPolicy() : document->contentSecurityPolicy(); 117 ContentSecurityPolicy* csp = m_workerObject->contentSecurityPolicy() ? m_wor kerObject->contentSecurityPolicy() : document->contentSecurityPolicy();
118 DCHECK(csp); 118 DCHECK(csp);
119 119
120 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do cument); 120 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do cument);
121 std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupDa ta::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers(). get(), m_workerObject->referrerPolicy(), starterOrigin, m_workerClients.release( ), document->addressSpace(), OriginTrialContext::getTokens(document).get()); 121 std::unique_ptr<WorkerSettings> workerSettings = wrapUnique(new WorkerSettin gs(document->settings()));
122 std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupDa ta::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers(). get(), m_workerObject->referrerPolicy(), starterOrigin, m_workerClients.release( ), document->addressSpace(), OriginTrialContext::getTokens(document).get(), std: :move(workerSettings));
122 double originTime = document->loader() ? document->loader()->timing().refere nceMonotonicTime() : monotonicallyIncreasingTime(); 123 double originTime = document->loader() ? document->loader()->timing().refere nceMonotonicTime() : monotonicallyIncreasingTime();
123 124
124 m_loaderProxy = WorkerLoaderProxy::create(this); 125 m_loaderProxy = WorkerLoaderProxy::create(this);
125 m_workerThread = createWorkerThread(originTime); 126 m_workerThread = createWorkerThread(originTime);
126 m_workerThread->start(std::move(startupData)); 127 m_workerThread->start(std::move(startupData));
127 workerThreadCreated(); 128 workerThreadCreated();
128 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); 129 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL);
129 } 130 }
130 131
131 void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<Seriali zedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) 132 void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<Seriali zedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels)
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 299
299 bool InProcessWorkerMessagingProxy::isParentContextThread() const 300 bool InProcessWorkerMessagingProxy::isParentContextThread() const
300 { 301 {
301 // TODO(nhiroki): Nested worker is not supported yet, so the parent context 302 // TODO(nhiroki): Nested worker is not supported yet, so the parent context
302 // thread should be equal to the main thread (http://crbug.com/31666). 303 // thread should be equal to the main thread (http://crbug.com/31666).
303 DCHECK(getExecutionContext()->isDocument()); 304 DCHECK(getExecutionContext()->isDocument());
304 return isMainThread(); 305 return isMainThread();
305 } 306 }
306 307
307 } // namespace blink 308 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698