| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/ScriptWrappable.h" | 6 #include "bindings/core/v8/ScriptWrappable.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/DOMDataStore.h" | 8 #include "bindings/core/v8/DOMDataStore.h" |
| 9 #include "bindings/core/v8/V8DOMWrapper.h" | 9 #include "bindings/core/v8/V8DOMWrapper.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 #if COMPILER(MSVC) | 13 #if COMPILER(MSVC) |
| 14 __declspec(align(4)) | 14 __declspec(align(4)) |
| 15 #endif | 15 #endif |
| 16 struct SameSizeAsScriptWrappableBase { }; | 16 struct SameSizeAsScriptWrappableBase { }; |
| 17 | 17 |
| 18 COMPILE_ASSERT(sizeof(ScriptWrappableBase) <= sizeof(SameSizeAsScriptWrappableBa
se), ScriptWrappableBase_should_stay_small); | 18 COMPILE_ASSERT(sizeof(ScriptWrappableBase) <= sizeof(SameSizeAsScriptWrappableBa
se), ScriptWrappableBase_should_stay_small); |
| 19 | 19 |
| 20 struct SameSizeAsScriptWrappable : public ScriptWrappableBase { | 20 struct SameSizeAsScriptWrappable : public ScriptWrappableBase { |
| 21 virtual ~SameSizeAsScriptWrappable() { } | 21 virtual ~SameSizeAsScriptWrappable() { } |
| 22 v8::Object* m_wrapper; | 22 v8::Object* m_wrapper; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 COMPILE_ASSERT(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), Scr
iptWrappable_should_stay_small); | 25 COMPILE_ASSERT(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), Scr
iptWrappable_should_stay_small); |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 class ScriptWrappableBaseProtector FINAL { | 29 class ScriptWrappableBaseProtector final { |
| 30 WTF_MAKE_NONCOPYABLE(ScriptWrappableBaseProtector); | 30 WTF_MAKE_NONCOPYABLE(ScriptWrappableBaseProtector); |
| 31 public: | 31 public: |
| 32 ScriptWrappableBaseProtector(ScriptWrappableBase* scriptWrappableBase, const
WrapperTypeInfo* wrapperTypeInfo) | 32 ScriptWrappableBaseProtector(ScriptWrappableBase* scriptWrappableBase, const
WrapperTypeInfo* wrapperTypeInfo) |
| 33 : m_scriptWrappableBase(scriptWrappableBase), m_wrapperTypeInfo(wrapperT
ypeInfo) | 33 : m_scriptWrappableBase(scriptWrappableBase), m_wrapperTypeInfo(wrapperT
ypeInfo) |
| 34 { | 34 { |
| 35 m_wrapperTypeInfo->refObject(m_scriptWrappableBase); | 35 m_wrapperTypeInfo->refObject(m_scriptWrappableBase); |
| 36 } | 36 } |
| 37 ~ScriptWrappableBaseProtector() | 37 ~ScriptWrappableBaseProtector() |
| 38 { | 38 { |
| 39 m_wrapperTypeInfo->derefObject(m_scriptWrappableBase); | 39 m_wrapperTypeInfo->derefObject(m_scriptWrappableBase); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 64 wrapperTypeInfo->installConditionallyEnabledProperties(wrapper, isolate); | 64 wrapperTypeInfo->installConditionallyEnabledProperties(wrapper, isolate); |
| 65 return associateWithWrapper(wrapperTypeInfo, wrapper, isolate); | 65 return associateWithWrapper(wrapperTypeInfo, wrapper, isolate); |
| 66 } | 66 } |
| 67 | 67 |
| 68 v8::Handle<v8::Object> ScriptWrappable::associateWithWrapper(const WrapperTypeIn
fo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) | 68 v8::Handle<v8::Object> ScriptWrappable::associateWithWrapper(const WrapperTypeIn
fo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) |
| 69 { | 69 { |
| 70 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType
Info, wrapper, isolate); | 70 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType
Info, wrapper, isolate); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |