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

Side by Side Diff: trunk/Source/core/frame/DOMTimer.cpp

Issue 264333002: Revert 172810 "Add a "forwarded" flag to usergesture tokens." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // spinning too busily and provides a balance between CPU spinning and 46 // spinning too busily and provides a balance between CPU spinning and
47 // the smallest possible interval timer. 47 // the smallest possible interval timer.
48 static const double minimumInterval = 0.004; 48 static const double minimumInterval = 0.004;
49 49
50 static int timerNestingLevel = 0; 50 static int timerNestingLevel = 0;
51 51
52 static inline bool shouldForwardUserGesture(int interval, int nestingLevel) 52 static inline bool shouldForwardUserGesture(int interval, int nestingLevel)
53 { 53 {
54 return UserGestureIndicator::processingUserGesture() 54 return UserGestureIndicator::processingUserGesture()
55 && interval <= maxIntervalForUserGestureForwarding 55 && interval <= maxIntervalForUserGestureForwarding
56 && nestingLevel == 1 56 && nestingLevel == 1; // Gestures should not be forwarded to nested time rs.
57 && !UserGestureIndicator::currentToken()->wasForwarded();
58 } 57 }
59 58
60 double DOMTimer::hiddenPageAlignmentInterval() 59 double DOMTimer::hiddenPageAlignmentInterval()
61 { 60 {
62 // Timers on hidden pages are aligned so that they fire once per 61 // Timers on hidden pages are aligned so that they fire once per
63 // second at most. 62 // second at most.
64 return 1.0; 63 return 1.0;
65 } 64 }
66 65
67 double DOMTimer::visiblePageAlignmentInterval() 66 double DOMTimer::visiblePageAlignmentInterval()
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 { 115 {
117 return m_timeoutID; 116 return m_timeoutID;
118 } 117 }
119 118
120 void DOMTimer::fired() 119 void DOMTimer::fired()
121 { 120 {
122 ExecutionContext* context = executionContext(); 121 ExecutionContext* context = executionContext();
123 timerNestingLevel = m_nestingLevel; 122 timerNestingLevel = m_nestingLevel;
124 ASSERT(!context->activeDOMObjectsAreSuspended()); 123 ASSERT(!context->activeDOMObjectsAreSuspended());
125 // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. 124 // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
126 if (m_userGestureToken)
127 m_userGestureToken->setForwarded();
128 UserGestureIndicator gestureIndicator(m_userGestureToken.release()); 125 UserGestureIndicator gestureIndicator(m_userGestureToken.release());
129 126
130 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerFire", "d ata", InspectorTimerFireEvent::data(context, m_timeoutID)); 127 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerFire", "d ata", InspectorTimerFireEvent::data(context, m_timeoutID));
131 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 128 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
132 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTi mer(context, m_timeoutID); 129 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTi mer(context, m_timeoutID);
133 130
134 // Simple case for non-one-shot timers. 131 // Simple case for non-one-shot timers.
135 if (isActive()) { 132 if (isActive()) {
136 if (repeatInterval() && repeatInterval() < minimumInterval) { 133 if (repeatInterval() && repeatInterval() < minimumInterval) {
137 m_nestingLevel++; 134 m_nestingLevel++;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (fireTime - alignedTimeRoundedDown < minimumInterval) 202 if (fireTime - alignedTimeRoundedDown < minimumInterval)
206 return alignedTimeRoundedDown; 203 return alignedTimeRoundedDown;
207 204
208 return alignedTimeRoundedUp; 205 return alignedTimeRoundedUp;
209 } 206 }
210 207
211 return fireTime; 208 return fireTime;
212 } 209 }
213 210
214 } // namespace WebCore 211 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/LayoutTests/fast/events/popup-forwarded-postmessage-blocked-expected.txt ('k') | trunk/Source/core/frame/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698