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

Unified Diff: Source/WTF/wtf/AutodrainedPoolMac.mm

Issue 14097005: Restore AutodrainedPoolMac.mm, use it in blink/mac. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WTF/wtf/AutodrainedPool.h ('k') | Source/WTF/wtf/wtf.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WTF/wtf/AutodrainedPoolMac.mm
diff --git a/Source/WTF/wtf/Complex.h b/Source/WTF/wtf/AutodrainedPoolMac.mm
similarity index 73%
copy from Source/WTF/wtf/Complex.h
copy to Source/WTF/wtf/AutodrainedPoolMac.mm
index 40fe56a7bb75442efae4d589cf4970fcffee56f9..1c7f182ee068ecfbe3eb5ad01b87a8f407c11a5c 100644
--- a/Source/WTF/wtf/Complex.h
+++ b/Source/WTF/wtf/AutodrainedPoolMac.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,24 +26,32 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WTF_Complex_h
-#define WTF_Complex_h
+#import "config.h"
+#import "AutodrainedPool.h"
-#include <complex>
-#include <wtf/MathExtras.h>
+#import <Foundation/Foundation.h>
namespace WTF {
-typedef std::complex<double> Complex;
-
-inline Complex complexFromMagnitudePhase(double magnitude, double phase)
+AutodrainedPool::AutodrainedPool(int iterationLimit)
+ : m_iterationLimit(iterationLimit)
+ , m_iterationCount(0)
+ , m_pool([[NSAutoreleasePool alloc] init])
{
- return Complex(magnitude * cos(phase), magnitude * sin(phase));
}
-} // namespace WTF
+AutodrainedPool::~AutodrainedPool()
+{
+ [m_pool drain];
+}
-using WTF::Complex;
-using WTF::complexFromMagnitudePhase;
+void AutodrainedPool::cycle()
+{
+ if (++m_iterationCount == m_iterationLimit) {
+ [m_pool drain];
+ m_pool = [[NSAutoreleasePool alloc] init];
+ m_iterationCount = 0;
+ }
+}
-#endif // WTF_Complex_h
+} // namespace WTF
« no previous file with comments | « Source/WTF/wtf/AutodrainedPool.h ('k') | Source/WTF/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698