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

Side by Side Diff: third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes 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) 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 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 void MainThreadTaskRunner::resume() 96 void MainThreadTaskRunner::resume()
97 { 97 {
98 DCHECK(m_suspended); 98 DCHECK(m_suspended);
99 if (!m_pendingTasks.isEmpty()) 99 if (!m_pendingTasks.isEmpty())
100 m_pendingTasksTimer.startOneShot(0, BLINK_FROM_HERE); 100 m_pendingTasksTimer.startOneShot(0, BLINK_FROM_HERE);
101 101
102 m_suspended = false; 102 m_suspended = false;
103 } 103 }
104 104
105 void MainThreadTaskRunner::pendingTasksTimerFired(Timer<MainThreadTaskRunner>*) 105 void MainThreadTaskRunner::pendingTasksTimerFired(TimerBase*)
106 { 106 {
107 // If the owner m_context is about to be swept then it 107 // If the owner m_context is about to be swept then it
108 // is no longer safe to access. 108 // is no longer safe to access.
109 if (ThreadHeap::willObjectBeLazilySwept(m_context.get())) 109 if (ThreadHeap::willObjectBeLazilySwept(m_context.get()))
110 return; 110 return;
111 111
112 while (!m_pendingTasks.isEmpty()) { 112 while (!m_pendingTasks.isEmpty()) {
113 std::unique_ptr<ExecutionContextTask> task = std::move(m_pendingTasks[0] .first); 113 std::unique_ptr<ExecutionContextTask> task = std::move(m_pendingTasks[0] .first);
114 const bool instrumenting = m_pendingTasks[0].second; 114 const bool instrumenting = m_pendingTasks[0].second;
115 m_pendingTasks.remove(0); 115 m_pendingTasks.remove(0);
116 InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(), ins trumenting); 116 InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(), ins trumenting);
117 task->performTask(m_context); 117 task->performTask(m_context);
118 } 118 }
119 } 119 }
120 120
121 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698