| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 template<typename FunctionWrapper, typename R, typename P1, typename P2> | 408 template<typename FunctionWrapper, typename R, typename P1, typename P2> |
| 409 class BoundFunctionImpl<FunctionWrapper, R (P1, P2)> : public FunctionImpl<typen
ame FunctionWrapper::ResultType ()> { | 409 class BoundFunctionImpl<FunctionWrapper, R (P1, P2)> : public FunctionImpl<typen
ame FunctionWrapper::ResultType ()> { |
| 410 public: | 410 public: |
| 411 BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p
2) | 411 BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p
2) |
| 412 : m_functionWrapper(functionWrapper) | 412 : m_functionWrapper(functionWrapper) |
| 413 , m_p1(ParamStorageTraits<P1>::wrap(p1)) | 413 , m_p1(ParamStorageTraits<P1>::wrap(p1)) |
| 414 , m_p2(ParamStorageTraits<P2>::wrap(p2)) | 414 , m_p2(ParamStorageTraits<P2>::wrap(p2)) |
| 415 { | 415 { |
| 416 } | 416 } |
| 417 | 417 |
| 418 virtual typename FunctionWrapper::ResultType operator()() | 418 virtual typename FunctionWrapper::ResultType operator()() |
| 419 { | 419 { |
| 420 return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStor
ageTraits<P2>::unwrap(m_p2)); | 420 return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStor
ageTraits<P2>::unwrap(m_p2)); |
| 421 } | 421 } |
| 422 | 422 |
| 423 private: | 423 private: |
| 424 FunctionWrapper m_functionWrapper; | 424 FunctionWrapper m_functionWrapper; |
| 425 typename ParamStorageTraits<P1>::StorageType m_p1; | 425 typename ParamStorageTraits<P1>::StorageType m_p1; |
| 426 typename ParamStorageTraits<P2>::StorageType m_p2; | 426 typename ParamStorageTraits<P2>::StorageType m_p2; |
| 427 }; | 427 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 453 class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3, P4)> : public FunctionIm
pl<typename FunctionWrapper::ResultType ()> { | 453 class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3, P4)> : public FunctionIm
pl<typename FunctionWrapper::ResultType ()> { |
| 454 public: | 454 public: |
| 455 BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p
2, const P3& p3, const P4& p4) | 455 BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p
2, const P3& p3, const P4& p4) |
| 456 : m_functionWrapper(functionWrapper) | 456 : m_functionWrapper(functionWrapper) |
| 457 , m_p1(ParamStorageTraits<P1>::wrap(p1)) | 457 , m_p1(ParamStorageTraits<P1>::wrap(p1)) |
| 458 , m_p2(ParamStorageTraits<P2>::wrap(p2)) | 458 , m_p2(ParamStorageTraits<P2>::wrap(p2)) |
| 459 , m_p3(ParamStorageTraits<P3>::wrap(p3)) | 459 , m_p3(ParamStorageTraits<P3>::wrap(p3)) |
| 460 , m_p4(ParamStorageTraits<P4>::wrap(p4)) | 460 , m_p4(ParamStorageTraits<P4>::wrap(p4)) |
| 461 { | 461 { |
| 462 } | 462 } |
| 463 | 463 |
| 464 virtual typename FunctionWrapper::ResultType operator()() | 464 virtual typename FunctionWrapper::ResultType operator()() |
| 465 { | 465 { |
| 466 return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStor
ageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageT
raits<P4>::unwrap(m_p4)); | 466 return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStor
ageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageT
raits<P4>::unwrap(m_p4)); |
| 467 } | 467 } |
| 468 | 468 |
| 469 private: | 469 private: |
| 470 FunctionWrapper m_functionWrapper; | 470 FunctionWrapper m_functionWrapper; |
| 471 typename ParamStorageTraits<P1>::StorageType m_p1; | 471 typename ParamStorageTraits<P1>::StorageType m_p1; |
| 472 typename ParamStorageTraits<P2>::StorageType m_p2; | 472 typename ParamStorageTraits<P2>::StorageType m_p2; |
| 473 typename ParamStorageTraits<P3>::StorageType m_p3; | 473 typename ParamStorageTraits<P3>::StorageType m_p3; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 FunctionBase() | 541 FunctionBase() |
| 542 { | 542 { |
| 543 } | 543 } |
| 544 | 544 |
| 545 explicit FunctionBase(PassRefPtr<FunctionImplBase> impl) | 545 explicit FunctionBase(PassRefPtr<FunctionImplBase> impl) |
| 546 : m_impl(impl) | 546 : m_impl(impl) |
| 547 { | 547 { |
| 548 } | 548 } |
| 549 | 549 |
| 550 template<typename FunctionType> FunctionImpl<FunctionType>* impl() const | 550 template<typename FunctionType> FunctionImpl<FunctionType>* impl() const |
| 551 { | 551 { |
| 552 return static_cast<FunctionImpl<FunctionType>*>(m_impl.get()); | 552 return static_cast<FunctionImpl<FunctionType>*>(m_impl.get()); |
| 553 } | 553 } |
| 554 | 554 |
| 555 private: | 555 private: |
| 556 RefPtr<FunctionImplBase> m_impl; | 556 RefPtr<FunctionImplBase> m_impl; |
| 557 }; | 557 }; |
| 558 | 558 |
| 559 template<typename> | 559 template<typename> |
| 560 class Function; | 560 class Function; |
| 561 | 561 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 typedef Function<void()> Closure; | 623 typedef Function<void()> Closure; |
| 624 | 624 |
| 625 } | 625 } |
| 626 | 626 |
| 627 using WTF::Function; | 627 using WTF::Function; |
| 628 using WTF::bind; | 628 using WTF::bind; |
| 629 using WTF::Closure; | 629 using WTF::Closure; |
| 630 | 630 |
| 631 #endif // WTF_Functional_h | 631 #endif // WTF_Functional_h |
| OLD | NEW |