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/ScriptState.h" | 5 #include "bindings/core/v8/ScriptState.h" |
6 | 6 |
7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 ScriptState::~ScriptState() { | 46 ScriptState::~ScriptState() { |
47 ASSERT(!m_perContextData); | 47 ASSERT(!m_perContextData); |
48 ASSERT(m_context.isEmpty()); | 48 ASSERT(m_context.isEmpty()); |
49 } | 49 } |
50 | 50 |
51 void ScriptState::detachGlobalObject() { | 51 void ScriptState::detachGlobalObject() { |
52 ASSERT(!m_context.isEmpty()); | 52 ASSERT(!m_context.isEmpty()); |
53 context()->DetachGlobal(); | 53 context()->DetachGlobal(); |
54 #if DCHECK_IS_ON() | |
55 m_globalObjectDetached = true; | |
56 #endif | |
57 } | 54 } |
58 | 55 |
59 void ScriptState::disposePerContextData() { | 56 void ScriptState::disposePerContextData() { |
60 m_perContextData = nullptr; | 57 m_perContextData = nullptr; |
61 } | 58 } |
62 | 59 |
63 ScriptValue ScriptState::getFromExtrasExports(const char* name) { | 60 ScriptValue ScriptState::getFromExtrasExports(const char* name) { |
64 v8::HandleScope handleScope(m_isolate); | 61 v8::HandleScope handleScope(m_isolate); |
65 v8::Local<v8::Value> v8Value; | 62 v8::Local<v8::Value> v8Value; |
66 if (!context() | 63 if (!context() |
(...skipping 27 matching lines...) Expand all Loading... |
94 v8::HandleScope handleScope(toIsolate(frame)); | 91 v8::HandleScope handleScope(toIsolate(frame)); |
95 v8::Local<v8::Context> context = toV8Context(frame, world); | 92 v8::Local<v8::Context> context = toV8Context(frame, world); |
96 if (context.IsEmpty()) | 93 if (context.IsEmpty()) |
97 return nullptr; | 94 return nullptr; |
98 ScriptState* scriptState = ScriptState::from(context); | 95 ScriptState* scriptState = ScriptState::from(context); |
99 ASSERT(scriptState->contextIsValid()); | 96 ASSERT(scriptState->contextIsValid()); |
100 return scriptState; | 97 return scriptState; |
101 } | 98 } |
102 | 99 |
103 } // namespace blink | 100 } // namespace blink |
OLD | NEW |