Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 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 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 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 #include "bindings/core/v8/V8PerContextData.h" | 31 #include "bindings/core/v8/V8PerContextData.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ConditionalFeatures.h" | 33 #include "bindings/core/v8/ConditionalFeatures.h" |
| 34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
| 35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
| 36 #include "bindings/core/v8/V8ObjectConstructor.h" | 36 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 37 #include "core/dom/Modulator.h" | |
| 37 #include "platform/InstanceCounters.h" | 38 #include "platform/InstanceCounters.h" |
| 38 #include "wtf/PtrUtil.h" | 39 #include "wtf/PtrUtil.h" |
| 39 #include "wtf/StringExtras.h" | 40 #include "wtf/StringExtras.h" |
| 40 #include <memory> | 41 #include <memory> |
| 41 #include <stdlib.h> | 42 #include <stdlib.h> |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) | 46 V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) |
| 46 : m_isolate(context->GetIsolate()), | 47 : m_isolate(context->GetIsolate()), |
| 47 m_wrapperBoilerplates(m_isolate), | 48 m_wrapperBoilerplates(m_isolate), |
| 48 m_constructorMap(m_isolate), | 49 m_constructorMap(m_isolate), |
| 49 m_contextHolder(WTF::makeUnique<gin::ContextHolder>(m_isolate)), | 50 m_contextHolder(WTF::makeUnique<gin::ContextHolder>(m_isolate)), |
| 50 m_context(m_isolate, context), | 51 m_context(m_isolate, context), |
| 51 m_activityLogger(0) { | 52 m_activityLogger(nullptr) { |
| 52 m_contextHolder->SetContext(context); | 53 m_contextHolder->SetContext(context); |
| 53 | 54 |
| 54 v8::Context::Scope contextScope(context); | 55 v8::Context::Scope contextScope(context); |
| 55 ASSERT(m_errorPrototype.isEmpty()); | 56 ASSERT(m_errorPrototype.isEmpty()); |
| 56 v8::Local<v8::Value> objectValue = | 57 v8::Local<v8::Value> objectValue = |
| 57 context->Global() | 58 context->Global() |
| 58 ->Get(context, v8AtomicString(m_isolate, "Error")) | 59 ->Get(context, v8AtomicString(m_isolate, "Error")) |
| 59 .ToLocalChecked(); | 60 .ToLocalChecked(); |
| 60 v8::Local<v8::Value> prototypeValue = | 61 v8::Local<v8::Value> prototypeValue = |
| 61 objectValue.As<v8::Object>() | 62 objectValue.As<v8::Object>() |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 !prototypeValue->IsObject()) | 168 !prototypeValue->IsObject()) |
| 168 return v8::Local<v8::Object>(); | 169 return v8::Local<v8::Object>(); |
| 169 return prototypeValue.As<v8::Object>(); | 170 return prototypeValue.As<v8::Object>(); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void V8PerContextData::addCustomElementBinding( | 173 void V8PerContextData::addCustomElementBinding( |
| 173 std::unique_ptr<V0CustomElementBinding> binding) { | 174 std::unique_ptr<V0CustomElementBinding> binding) { |
| 174 m_customElementBindings.push_back(std::move(binding)); | 175 m_customElementBindings.push_back(std::move(binding)); |
| 175 } | 176 } |
| 176 | 177 |
| 178 void V8PerContextData::setModulator(Modulator* modulator) { | |
| 179 m_modulator = modulator; | |
|
dominicc (has gone to gerrit)
2017/01/11 03:23:47
DCHECK(!m_modulator); ?
kouhei (in TOK)
2017/01/17 05:26:13
Done.
| |
| 180 } | |
| 181 | |
| 177 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |