| 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 "bindings/core/v8/ScriptPromisePropertyBase.h" | 5 #include "bindings/core/v8/ScriptPromisePropertyBase.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScopedPersistent.h" | 7 #include "bindings/core/v8/ScopedPersistent.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8HiddenValue.h" | 10 #include "bindings/core/v8/V8HiddenValue.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 v8::Local<v8::Object> wrapper = persistent->newLocal(m_isolate); | 141 v8::Local<v8::Object> wrapper = persistent->newLocal(m_isolate); |
| 142 if (wrapper->CreationContext() == context) | 142 if (wrapper->CreationContext() == context) |
| 143 return wrapper; | 143 return wrapper; |
| 144 ++i; | 144 ++i; |
| 145 } | 145 } |
| 146 v8::Local<v8::Object> wrapper = holder(m_isolate, context->Global()); | 146 v8::Local<v8::Object> wrapper = holder(m_isolate, context->Global()); |
| 147 OwnPtr<ScopedPersistent<v8::Object>> weakPersistent = adoptPtr(new ScopedPer
sistent<v8::Object>); | 147 OwnPtr<ScopedPersistent<v8::Object>> weakPersistent = adoptPtr(new ScopedPer
sistent<v8::Object>); |
| 148 weakPersistent->set(m_isolate, wrapper); | 148 weakPersistent->set(m_isolate, wrapper); |
| 149 weakPersistent->setWeak(weakPersistent.get(), &clearHandle); | 149 weakPersistent->setWeak(weakPersistent.get(), &clearHandle); |
| 150 m_wrappers.append(weakPersistent.release()); | 150 m_wrappers.append(std::move(weakPersistent)); |
| 151 return wrapper; | 151 return wrapper; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ScriptPromisePropertyBase::clearWrappers() | 154 void ScriptPromisePropertyBase::clearWrappers() |
| 155 { | 155 { |
| 156 checkThis(); | 156 checkThis(); |
| 157 checkWrappers(); | 157 checkWrappers(); |
| 158 v8::HandleScope handleScope(m_isolate); | 158 v8::HandleScope handleScope(m_isolate); |
| 159 for (WeakPersistentSet::iterator i = m_wrappers.begin(); i != m_wrappers.end
(); ++i) { | 159 for (WeakPersistentSet::iterator i = m_wrappers.begin(); i != m_wrappers.end
(); ++i) { |
| 160 v8::Local<v8::Object> wrapper = (*i)->newLocal(m_isolate); | 160 v8::Local<v8::Object> wrapper = (*i)->newLocal(m_isolate); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ASSERT_NOT_REACHED(); | 208 ASSERT_NOT_REACHED(); |
| 209 return v8::Local<v8::String>(); | 209 return v8::Local<v8::String>(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 DEFINE_TRACE(ScriptPromisePropertyBase) | 212 DEFINE_TRACE(ScriptPromisePropertyBase) |
| 213 { | 213 { |
| 214 ContextLifecycleObserver::trace(visitor); | 214 ContextLifecycleObserver::trace(visitor); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |