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

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

Issue 2220213002: [worklets] Move ConsoleMessageStorage to WorkerThread instead of WorkerGlobalScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments. 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, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 void WorkerGlobalScope::postTask(const WebTraceLocation& location, std::unique_p tr<ExecutionContextTask> task, const String& taskNameForInstrumentation) 253 void WorkerGlobalScope::postTask(const WebTraceLocation& location, std::unique_p tr<ExecutionContextTask> task, const String& taskNameForInstrumentation)
254 { 254 {
255 thread()->postTask(location, std::move(task), !taskNameForInstrumentation.is Empty()); 255 thread()->postTask(location, std::move(task), !taskNameForInstrumentation.is Empty());
256 } 256 }
257 257
258 void WorkerGlobalScope::addConsoleMessage(ConsoleMessage* consoleMessage) 258 void WorkerGlobalScope::addConsoleMessage(ConsoleMessage* consoleMessage)
259 { 259 {
260 DCHECK(isContextThread()); 260 DCHECK(isContextThread());
261 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage->source (), consoleMessage->level(), consoleMessage->message(), consoleMessage->location ()); 261 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage->source (), consoleMessage->level(), consoleMessage->message(), consoleMessage->location ());
262 m_consoleMessageStorage->addConsoleMessage(this, consoleMessage); 262 thread()->consoleMessageStorage()->addConsoleMessage(this, consoleMessage);
263 } 263 }
264 264
265 WorkerEventQueue* WorkerGlobalScope::getEventQueue() const 265 WorkerEventQueue* WorkerGlobalScope::getEventQueue() const
266 { 266 {
267 return m_eventQueue.get(); 267 return m_eventQueue.get();
268 } 268 }
269 269
270 bool WorkerGlobalScope::isSecureContext(String& errorMessage, const SecureContex tCheck privilegeContextCheck) const 270 bool WorkerGlobalScope::isSecureContext(String& errorMessage, const SecureContex tCheck privilegeContextCheck) const
271 { 271 {
272 // Until there are APIs that are available in workers and that 272 // Until there are APIs that are available in workers and that
(...skipping 17 matching lines...) Expand all
290 : m_url(url) 290 : m_url(url)
291 , m_userAgent(userAgent) 291 , m_userAgent(userAgent)
292 , m_v8CacheOptions(V8CacheOptionsDefault) 292 , m_v8CacheOptions(V8CacheOptionsDefault)
293 , m_scriptController(WorkerOrWorkletScriptController::create(this, thread->i solate())) 293 , m_scriptController(WorkerOrWorkletScriptController::create(this, thread->i solate()))
294 , m_thread(thread) 294 , m_thread(thread)
295 , m_closing(false) 295 , m_closing(false)
296 , m_eventQueue(WorkerEventQueue::create(this)) 296 , m_eventQueue(WorkerEventQueue::create(this))
297 , m_workerClients(workerClients) 297 , m_workerClients(workerClients)
298 , m_timers(Platform::current()->currentThread()->scheduler()->timerTaskRunne r()->clone()) 298 , m_timers(Platform::current()->currentThread()->scheduler()->timerTaskRunne r()->clone())
299 , m_timeOrigin(timeOrigin) 299 , m_timeOrigin(timeOrigin)
300 , m_consoleMessageStorage(new ConsoleMessageStorage())
301 , m_lastPendingErrorEventId(0) 300 , m_lastPendingErrorEventId(0)
302 { 301 {
303 setSecurityOrigin(SecurityOrigin::create(url)); 302 setSecurityOrigin(SecurityOrigin::create(url));
304 if (starterOriginPrivilageData) 303 if (starterOriginPrivilageData)
305 getSecurityOrigin()->transferPrivilegesFrom(std::move(starterOriginPrivi lageData)); 304 getSecurityOrigin()->transferPrivilegesFrom(std::move(starterOriginPrivi lageData));
306 305
307 if (m_workerClients) 306 if (m_workerClients)
308 m_workerClients->reattachThread(); 307 m_workerClients->reattachThread();
309 } 308 }
310 309
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 341 }
343 342
344 DEFINE_TRACE(WorkerGlobalScope) 343 DEFINE_TRACE(WorkerGlobalScope)
345 { 344 {
346 visitor->trace(m_location); 345 visitor->trace(m_location);
347 visitor->trace(m_navigator); 346 visitor->trace(m_navigator);
348 visitor->trace(m_scriptController); 347 visitor->trace(m_scriptController);
349 visitor->trace(m_eventQueue); 348 visitor->trace(m_eventQueue);
350 visitor->trace(m_workerClients); 349 visitor->trace(m_workerClients);
351 visitor->trace(m_timers); 350 visitor->trace(m_timers);
352 visitor->trace(m_consoleMessageStorage);
353 visitor->trace(m_eventListeners); 351 visitor->trace(m_eventListeners);
354 visitor->trace(m_pendingErrorEvents); 352 visitor->trace(m_pendingErrorEvents);
355 ExecutionContext::trace(visitor); 353 ExecutionContext::trace(visitor);
356 EventTargetWithInlineData::trace(visitor); 354 EventTargetWithInlineData::trace(visitor);
357 SecurityContext::trace(visitor); 355 SecurityContext::trace(visitor);
358 Supplementable<WorkerGlobalScope>::trace(visitor); 356 Supplementable<WorkerGlobalScope>::trace(visitor);
359 } 357 }
360 358
361 } // namespace blink 359 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerGlobalScope.h ('k') | third_party/WebKit/Source/core/workers/WorkerThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698