| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google, 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef EventFactory_h | 26 #ifndef EventFactory_h |
| 27 #define EventFactory_h | 27 #define EventFactory_h |
| 28 | 28 |
| 29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 30 #include "wtf/Allocator.h" | 30 #include "wtf/Allocator.h" |
| 31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 32 #include "wtf/PtrUtil.h" |
| 32 #include "wtf/text/AtomicString.h" | 33 #include "wtf/text/AtomicString.h" |
| 34 #include <memory> |
| 33 | 35 |
| 34 namespace blink { | 36 namespace blink { |
| 35 | 37 |
| 36 class Event; | 38 class Event; |
| 37 class ExecutionContext; | 39 class ExecutionContext; |
| 38 | 40 |
| 39 class EventFactoryBase { | 41 class EventFactoryBase { |
| 40 USING_FAST_MALLOC(EventFactoryBase); | 42 USING_FAST_MALLOC(EventFactoryBase); |
| 41 public: | 43 public: |
| 42 virtual Event* create(ExecutionContext*, const String& eventType) = 0; | 44 virtual Event* create(ExecutionContext*, const String& eventType) = 0; |
| 43 virtual ~EventFactoryBase() { } | 45 virtual ~EventFactoryBase() { } |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 EventFactoryBase() { } | 48 EventFactoryBase() { } |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 class EventFactory final : public EventFactoryBase { | 51 class EventFactory final : public EventFactoryBase { |
| 50 public: | 52 public: |
| 51 static PassOwnPtr<EventFactory> create() | 53 static std::unique_ptr<EventFactory> create() |
| 52 { | 54 { |
| 53 return adoptPtr(new EventFactory()); | 55 return wrapUnique(new EventFactory()); |
| 54 } | 56 } |
| 55 | 57 |
| 56 Event* create(ExecutionContext*, const String& eventType) override; | 58 Event* create(ExecutionContext*, const String& eventType) override; |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace blink | 61 } // namespace blink |
| 60 | 62 |
| 61 #endif | 63 #endif |
| OLD | NEW |