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

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

Issue 329183002: Removing "using" declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed Trybot Errors 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
38 namespace WebCore { 36 namespace WebCore {
39 37
40 static const int maxIntervalForUserGestureForwarding = 1000; // One second match es Gecko. 38 static const int maxIntervalForUserGestureForwarding = 1000; // One second match es Gecko.
41 static const int maxTimerNestingLevel = 5; 39 static const int maxTimerNestingLevel = 5;
42 static const double oneMillisecond = 0.001; 40 static const double oneMillisecond = 0.001;
43 // Chromium uses a minimum timer interval of 4ms. We'd like to go 41 // Chromium uses a minimum timer interval of 4ms. We'd like to go
44 // lower; however, there are poorly coded websites out there which do 42 // lower; however, there are poorly coded websites out there which do
45 // create CPU-spinning loops. Using 4ms prevents the CPU from 43 // create CPU-spinning loops. Using 4ms prevents the CPU from
46 // spinning too busily and provides a balance between CPU spinning and 44 // spinning too busily and provides a balance between CPU spinning and
47 // the smallest possible interval timer. 45 // the smallest possible interval timer.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action , int interval, bool singleShot, int timeoutID) 89 DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action , int interval, bool singleShot, int timeoutID)
92 : SuspendableTimer(context) 90 : SuspendableTimer(context)
93 , m_timeoutID(timeoutID) 91 , m_timeoutID(timeoutID)
94 , m_nestingLevel(timerNestingLevel + 1) 92 , m_nestingLevel(timerNestingLevel + 1)
95 , m_action(action) 93 , m_action(action)
96 { 94 {
97 ASSERT(timeoutID > 0); 95 ASSERT(timeoutID > 0);
98 if (shouldForwardUserGesture(interval, m_nestingLevel)) 96 if (shouldForwardUserGesture(interval, m_nestingLevel))
99 m_userGestureToken = UserGestureIndicator::currentToken(); 97 m_userGestureToken = UserGestureIndicator::currentToken();
100 98
101 double intervalMilliseconds = max(oneMillisecond, interval * oneMillisecond) ; 99 double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillise cond);
102 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest ingLevel) 100 if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNest ingLevel)
103 intervalMilliseconds = minimumInterval; 101 intervalMilliseconds = minimumInterval;
104 if (singleShot) 102 if (singleShot)
105 startOneShot(intervalMilliseconds, FROM_HERE); 103 startOneShot(intervalMilliseconds, FROM_HERE);
106 else 104 else
107 startRepeating(intervalMilliseconds, FROM_HERE); 105 startRepeating(intervalMilliseconds, FROM_HERE);
108 } 106 }
109 107
110 DOMTimer::~DOMTimer() 108 DOMTimer::~DOMTimer()
111 { 109 {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (fireTime - alignedTimeRoundedDown < minimumInterval) 200 if (fireTime - alignedTimeRoundedDown < minimumInterval)
203 return alignedTimeRoundedDown; 201 return alignedTimeRoundedDown;
204 202
205 return alignedTimeRoundedUp; 203 return alignedTimeRoundedUp;
206 } 204 }
207 205
208 return fireTime; 206 return fireTime;
209 } 207 }
210 208
211 } // namespace WebCore 209 } // 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