| 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
|
|
|