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

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

Issue 330933002: Revert of Removing "using" declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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/fileapi/FileReaderLoader.cpp ('k') | Source/core/frame/ImageBitmap.cpp » ('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 15 matching lines...) Expand all
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/frame/DOMTimer.h" 28 #include "core/frame/DOMTimer.h"
29 29
30 #include "core/dom/ExecutionContext.h" 30 #include "core/dom/ExecutionContext.h"
31 #include "core/inspector/InspectorInstrumentation.h" 31 #include "core/inspector/InspectorInstrumentation.h"
32 #include "core/inspector/InspectorTraceEvents.h" 32 #include "core/inspector/InspectorTraceEvents.h"
33 #include "platform/TraceEvent.h" 33 #include "platform/TraceEvent.h"
34 #include "wtf/CurrentTime.h" 34 #include "wtf/CurrentTime.h"
35 35
36 using namespace std;
37
36 namespace WebCore { 38 namespace WebCore {
37 39
38 static const int maxIntervalForUserGestureForwarding = 1000; // One second match es Gecko. 40 static const int maxIntervalForUserGestureForwarding = 1000; // One second match es Gecko.
39 static const int maxTimerNestingLevel = 5; 41 static const int maxTimerNestingLevel = 5;
40 static const double oneMillisecond = 0.001; 42 static const double oneMillisecond = 0.001;
41 // Chromium uses a minimum timer interval of 4ms. We'd like to go 43 // Chromium uses a minimum timer interval of 4ms. We'd like to go
42 // lower; however, there are poorly coded websites out there which do 44 // lower; however, there are poorly coded websites out there which do
43 // create CPU-spinning loops. Using 4ms prevents the CPU from 45 // create CPU-spinning loops. Using 4ms prevents the CPU from
44 // spinning too busily and provides a balance between CPU spinning and 46 // spinning too busily and provides a balance between CPU spinning and
45 // the smallest possible interval timer. 47 // the smallest possible interval timer.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action , int interval, bool singleShot, int timeoutID) 91 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action , int interval, bool singleShot, int timeoutID)
90 : SuspendableTimer(context) 92 : SuspendableTimer(context)
91 , m_timeoutID(timeoutID) 93 , m_timeoutID(timeoutID)
92 , m_nestingLevel(timerNestingLevel + 1) 94 , m_nestingLevel(timerNestingLevel + 1)
93 , m_action(action) 95 , m_action(action)
94 { 96 {
95 ASSERT(timeoutID > 0); 97 ASSERT(timeoutID > 0);
96 if (shouldForwardUserGesture(interval, m_nestingLevel)) 98 if (shouldForwardUserGesture(interval, m_nestingLevel))
97 m_userGestureToken = UserGestureIndicator::currentToken(); 99 m_userGestureToken = UserGestureIndicator::currentToken();
98 100
99 double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillise cond); 101 double intervalMilliseconds = max(oneMillisecond, interval * oneMillisecond) ;
100 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest ingLevel) 102 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest ingLevel)
101 intervalMilliseconds = minimumInterval; 103 intervalMilliseconds = minimumInterval;
102 if (singleShot) 104 if (singleShot)
103 startOneShot(intervalMilliseconds, FROM_HERE); 105 startOneShot(intervalMilliseconds, FROM_HERE);
104 else 106 else
105 startRepeating(intervalMilliseconds, FROM_HERE); 107 startRepeating(intervalMilliseconds, FROM_HERE);
106 } 108 }
107 109
108 DOMTimer::~DOMTimer() 110 DOMTimer::~DOMTimer()
109 { 111 {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (fireTime - alignedTimeRoundedDown < minimumInterval) 202 if (fireTime - alignedTimeRoundedDown < minimumInterval)
201 return alignedTimeRoundedDown; 203 return alignedTimeRoundedDown;
202 204
203 return alignedTimeRoundedUp; 205 return alignedTimeRoundedUp;
204 } 206 }
205 207
206 return fireTime; 208 return fireTime;
207 } 209 }
208 210
209 } // namespace WebCore 211 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.cpp ('k') | Source/core/frame/ImageBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698