Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2017 Google Inc. All rights reserved. |
|
jbroman
2017/04/25 21:45:34
Here and elsewhere: don't update copyright headers
adithyas
2017/04/26 19:44:50
Done.
| |
| 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScriptWrappable_h | 31 #ifndef ScriptWrappable_h |
| 32 #define ScriptWrappable_h | 32 #define ScriptWrappable_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptWrappableVisitor.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "bindings/core/v8/WrapperTypeInfo.h" | 35 #include "platform/bindings/ScriptWrappableVisitor.h" |
| 36 #include "core/CoreExport.h" | 36 #include "platform/bindings/WrapperTypeInfo.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/wtf/Compiler.h" | 38 #include "platform/wtf/Compiler.h" |
| 39 #include "platform/wtf/Noncopyable.h" | 39 #include "platform/wtf/Noncopyable.h" |
| 40 #include "platform/wtf/TypeTraits.h" | 40 #include "platform/wtf/TypeTraits.h" |
| 41 #include "v8/include/v8.h" | 41 #include "v8/include/v8.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class CORE_EXPORT TraceWrapperBase { | 45 class PLATFORM_EXPORT TraceWrapperBase { |
| 46 WTF_MAKE_NONCOPYABLE(TraceWrapperBase); | 46 WTF_MAKE_NONCOPYABLE(TraceWrapperBase); |
| 47 | 47 |
| 48 public: | 48 public: |
| 49 TraceWrapperBase() = default; | 49 TraceWrapperBase() = default; |
| 50 virtual bool IsScriptWrappable() const { return false; } | 50 virtual bool IsScriptWrappable() const { return false; } |
| 51 | 51 |
| 52 DECLARE_VIRTUAL_TRACE_WRAPPERS(){}; | 52 DECLARE_VIRTUAL_TRACE_WRAPPERS(){}; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // ScriptWrappable provides a way to map from/to C++ DOM implementation to/from | 55 // ScriptWrappable provides a way to map from/to C++ DOM implementation to/from |
| 56 // JavaScript object (platform object). ToV8() converts a ScriptWrappable to | 56 // JavaScript object (platform object). ToV8() converts a ScriptWrappable to |
| 57 // a v8::Object and toScriptWrappable() converts a v8::Object back to | 57 // a v8::Object and toScriptWrappable() converts a v8::Object back to |
| 58 // a ScriptWrappable. v8::Object as platform object is called "wrapper object". | 58 // a ScriptWrappable. v8::Object as platform object is called "wrapper object". |
| 59 // The wrapepr object for the main world is stored in ScriptWrappable. Wrapper | 59 // The wrapepr object for the main world is stored in ScriptWrappable. Wrapper |
| 60 // objects for other worlds are stored in DOMWrapperMap. | 60 // objects for other worlds are stored in DOMWrapperMap. |
| 61 class CORE_EXPORT ScriptWrappable : public TraceWrapperBase { | 61 class PLATFORM_EXPORT ScriptWrappable : public TraceWrapperBase { |
| 62 WTF_MAKE_NONCOPYABLE(ScriptWrappable); | 62 WTF_MAKE_NONCOPYABLE(ScriptWrappable); |
| 63 | 63 |
| 64 public: | 64 public: |
| 65 ScriptWrappable() {} | 65 ScriptWrappable() {} |
| 66 | 66 |
| 67 bool IsScriptWrappable() const override { return true; } | 67 bool IsScriptWrappable() const override { return true; } |
| 68 | 68 |
| 69 template <typename T> | 69 template <typename T> |
| 70 T* ToImpl() { | 70 T* ToImpl() { |
| 71 // All ScriptWrappables are managed by the Blink GC heap; check that | 71 // All ScriptWrappables are managed by the Blink GC heap; check that |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 #define DECLARE_WRAPPERTYPEINFO() \ | 204 #define DECLARE_WRAPPERTYPEINFO() \ |
| 205 public: \ | 205 public: \ |
| 206 const WrapperTypeInfo* GetWrapperTypeInfo() const override; \ | 206 const WrapperTypeInfo* GetWrapperTypeInfo() const override; \ |
| 207 \ | 207 \ |
| 208 private: \ | 208 private: \ |
| 209 typedef void end_of_define_wrappertypeinfo_not_reached_t | 209 typedef void end_of_define_wrappertypeinfo_not_reached_t |
| 210 | 210 |
| 211 } // namespace blink | 211 } // namespace blink |
| 212 | 212 |
| 213 #endif // ScriptWrappable_h | 213 #endif // ScriptWrappable_h |
| OLD | NEW |