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

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

Issue 631133003: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/core/workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/workers/WorkerScriptLoader.h ('k') | Source/core/workers/WorkerThreadStartupData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include <utility> 51 #include <utility>
52 52
53 namespace blink { 53 namespace blink {
54 54
55 namespace { 55 namespace {
56 const int64 kShortIdleHandlerDelayMs = 1000; 56 const int64 kShortIdleHandlerDelayMs = 1000;
57 const int64 kLongIdleHandlerDelayMs = 10*1000; 57 const int64 kLongIdleHandlerDelayMs = 10*1000;
58 58
59 class MicrotaskRunner : public WebThread::TaskObserver { 59 class MicrotaskRunner : public WebThread::TaskObserver {
60 public: 60 public:
61 virtual void willProcessTask() OVERRIDE { } 61 virtual void willProcessTask() override { }
62 virtual void didProcessTask() OVERRIDE 62 virtual void didProcessTask() override
63 { 63 {
64 Microtask::performCheckpoint(); 64 Microtask::performCheckpoint();
65 } 65 }
66 }; 66 };
67 67
68 } // namespace 68 } // namespace
69 69
70 static Mutex& threadSetMutex() 70 static Mutex& threadSetMutex()
71 { 71 {
72 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); 72 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
73 return mutex; 73 return mutex;
74 } 74 }
75 75
76 static HashSet<WorkerThread*>& workerThreads() 76 static HashSet<WorkerThread*>& workerThreads()
77 { 77 {
78 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ()); 78 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ());
79 return threads; 79 return threads;
80 } 80 }
81 81
82 unsigned WorkerThread::workerThreadCount() 82 unsigned WorkerThread::workerThreadCount()
83 { 83 {
84 MutexLocker lock(threadSetMutex()); 84 MutexLocker lock(threadSetMutex());
85 return workerThreads().size(); 85 return workerThreads().size();
86 } 86 }
87 87
88 class WorkerThreadCancelableTask FINAL : public ExecutionContextTask { 88 class WorkerThreadCancelableTask final : public ExecutionContextTask {
89 WTF_MAKE_NONCOPYABLE(WorkerThreadCancelableTask); WTF_MAKE_FAST_ALLOCATED; 89 WTF_MAKE_NONCOPYABLE(WorkerThreadCancelableTask); WTF_MAKE_FAST_ALLOCATED;
90 public: 90 public:
91 static PassOwnPtr<WorkerThreadCancelableTask> create(const Closure& closure) 91 static PassOwnPtr<WorkerThreadCancelableTask> create(const Closure& closure)
92 { 92 {
93 return adoptPtr(new WorkerThreadCancelableTask(closure)); 93 return adoptPtr(new WorkerThreadCancelableTask(closure));
94 } 94 }
95 95
96 virtual void performTask(ExecutionContext*) OVERRIDE 96 virtual void performTask(ExecutionContext*) override
97 { 97 {
98 if (!m_taskCanceled) 98 if (!m_taskCanceled)
99 m_closure(); 99 m_closure();
100 } 100 }
101 101
102 void cancelTask() { m_taskCanceled = true; } 102 void cancelTask() { m_taskCanceled = true; }
103 103
104 private: 104 private:
105 explicit WorkerThreadCancelableTask(const Closure& closure) 105 explicit WorkerThreadCancelableTask(const Closure& closure)
106 : m_closure(closure) 106 : m_closure(closure)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 class WorkerThreadTask : public blink::WebThread::Task { 181 class WorkerThreadTask : public blink::WebThread::Task {
182 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED; 182 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED;
183 public: 183 public:
184 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO wnPtr<ExecutionContextTask> task, bool isInstrumented) 184 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO wnPtr<ExecutionContextTask> task, bool isInstrumented)
185 { 185 {
186 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented) ); 186 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented) );
187 } 187 }
188 188
189 virtual ~WorkerThreadTask() { } 189 virtual ~WorkerThreadTask() { }
190 190
191 virtual void run() OVERRIDE 191 virtual void run() override
192 { 192 {
193 WorkerGlobalScope* workerGlobalScope = m_workerThread.workerGlobalScope( ); 193 WorkerGlobalScope* workerGlobalScope = m_workerThread.workerGlobalScope( );
194 // Tasks could be put on the message loop after the cleanup task, 194 // Tasks could be put on the message loop after the cleanup task,
195 // ensure none of those are ran. 195 // ensure none of those are ran.
196 if (!workerGlobalScope) 196 if (!workerGlobalScope)
197 return; 197 return;
198 198
199 if (m_isInstrumented) 199 if (m_isInstrumented)
200 InspectorInstrumentation::willPerformExecutionContextTask(workerGlob alScope, m_task.get()); 200 InspectorInstrumentation::willPerformExecutionContextTask(workerGlob alScope, m_task.get());
201 if ((!workerGlobalScope->isClosing() && !m_workerThread.terminated()) || m_task->isCleanupTask()) 201 if ((!workerGlobalScope->isClosing() && !m_workerThread.terminated()) || m_task->isCleanupTask())
(...skipping 12 matching lines...) Expand all
214 m_isInstrumented = !m_task->taskNameForInstrumentation().isEmpty(); 214 m_isInstrumented = !m_task->taskNameForInstrumentation().isEmpty();
215 if (m_isInstrumented) 215 if (m_isInstrumented)
216 InspectorInstrumentation::didPostExecutionContextTask(m_workerThread .workerGlobalScope(), m_task.get()); 216 InspectorInstrumentation::didPostExecutionContextTask(m_workerThread .workerGlobalScope(), m_task.get());
217 } 217 }
218 218
219 WorkerThread& m_workerThread; 219 WorkerThread& m_workerThread;
220 OwnPtr<ExecutionContextTask> m_task; 220 OwnPtr<ExecutionContextTask> m_task;
221 bool m_isInstrumented; 221 bool m_isInstrumented;
222 }; 222 };
223 223
224 class RunDebuggerQueueTask FINAL : public ExecutionContextTask { 224 class RunDebuggerQueueTask final : public ExecutionContextTask {
225 public: 225 public:
226 static PassOwnPtr<RunDebuggerQueueTask> create(WorkerThread* thread) 226 static PassOwnPtr<RunDebuggerQueueTask> create(WorkerThread* thread)
227 { 227 {
228 return adoptPtr(new RunDebuggerQueueTask(thread)); 228 return adoptPtr(new RunDebuggerQueueTask(thread));
229 } 229 }
230 virtual void performTask(ExecutionContext* context) OVERRIDE 230 virtual void performTask(ExecutionContext* context) override
231 { 231 {
232 ASSERT(context->isWorkerGlobalScope()); 232 ASSERT(context->isWorkerGlobalScope());
233 m_thread->runDebuggerTask(WorkerThread::DontWaitForMessage); 233 m_thread->runDebuggerTask(WorkerThread::DontWaitForMessage);
234 } 234 }
235 235
236 private: 236 private:
237 explicit RunDebuggerQueueTask(WorkerThread* thread) : m_thread(thread) { } 237 explicit RunDebuggerQueueTask(WorkerThread* thread) : m_thread(thread) { }
238 238
239 WorkerThread* m_thread; 239 WorkerThread* m_thread;
240 }; 240 };
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); 523 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get());
524 } 524 }
525 525
526 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) 526 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController)
527 { 527 {
528 MutexLocker locker(m_workerInspectorControllerMutex); 528 MutexLocker locker(m_workerInspectorControllerMutex);
529 m_workerInspectorController = workerInspectorController; 529 m_workerInspectorController = workerInspectorController;
530 } 530 }
531 531
532 } // namespace blink 532 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerScriptLoader.h ('k') | Source/core/workers/WorkerThreadStartupData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698