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

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

Issue 2402983002: [TimeZoneMonitor] Decouple renderer side impl from content to blink. (Closed)
Patch Set: Rebase only Created 4 years, 1 month 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 * 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 WorkerThread* m_workerThread; 110 WorkerThread* m_workerThread;
111 std::unique_ptr<CancellableTaskFactory> m_cancellableTaskFactory; 111 std::unique_ptr<CancellableTaskFactory> m_cancellableTaskFactory;
112 }; 112 };
113 113
114 static Mutex& threadSetMutex() { 114 static Mutex& threadSetMutex() {
115 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); 115 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex);
116 return mutex; 116 return mutex;
117 } 117 }
118 118
119 static HashSet<WorkerThread*>& workerThreads() {
120 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ());
121 return threads;
122 }
123
124 WorkerThreadLifecycleContext::WorkerThreadLifecycleContext() { 119 WorkerThreadLifecycleContext::WorkerThreadLifecycleContext() {
125 DCHECK(isMainThread()); 120 DCHECK(isMainThread());
126 } 121 }
127 122
128 WorkerThreadLifecycleContext::~WorkerThreadLifecycleContext() { 123 WorkerThreadLifecycleContext::~WorkerThreadLifecycleContext() {
129 DCHECK(isMainThread()); 124 DCHECK(isMainThread());
130 } 125 }
131 126
132 void WorkerThreadLifecycleContext::notifyContextDestroyed() { 127 void WorkerThreadLifecycleContext::notifyContextDestroyed() {
133 DCHECK(isMainThread()); 128 DCHECK(isMainThread());
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 WorkerInspectorController* WorkerThread::workerInspectorController() { 297 WorkerInspectorController* WorkerThread::workerInspectorController() {
303 DCHECK(isCurrentThread()); 298 DCHECK(isCurrentThread());
304 return m_workerInspectorController.get(); 299 return m_workerInspectorController.get();
305 } 300 }
306 301
307 unsigned WorkerThread::workerThreadCount() { 302 unsigned WorkerThread::workerThreadCount() {
308 MutexLocker lock(threadSetMutex()); 303 MutexLocker lock(threadSetMutex());
309 return workerThreads().size(); 304 return workerThreads().size();
310 } 305 }
311 306
307 HashSet<WorkerThread*>& WorkerThread::workerThreads() {
308 DCHECK(isMainThread());
309 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ());
310 return threads;
311 }
312
312 PlatformThreadId WorkerThread::platformThreadId() { 313 PlatformThreadId WorkerThread::platformThreadId() {
313 if (!m_requestedToStart) 314 if (!m_requestedToStart)
314 return 0; 315 return 0;
315 return workerBackingThread().backingThread().platformThread().threadId(); 316 return workerBackingThread().backingThread().platformThread().threadId();
316 } 317 }
317 318
318 bool WorkerThread::isForciblyTerminated() { 319 bool WorkerThread::isForciblyTerminated() {
319 MutexLocker lock(m_threadStateMutex); 320 MutexLocker lock(m_threadStateMutex);
320 switch (m_exitCode) { 321 switch (m_exitCode) {
321 case ExitCode::NotTerminated: 322 case ExitCode::NotTerminated:
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 MutexLocker lock(m_threadStateMutex); 670 MutexLocker lock(m_threadStateMutex);
670 return m_requestedToTerminate; 671 return m_requestedToTerminate;
671 } 672 }
672 673
673 ExitCode WorkerThread::getExitCodeForTesting() { 674 ExitCode WorkerThread::getExitCodeForTesting() {
674 MutexLocker lock(m_threadStateMutex); 675 MutexLocker lock(m_threadStateMutex);
675 return m_exitCode; 676 return m_exitCode;
676 } 677 }
677 678
678 } // namespace blink 679 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698