| 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" | |
| 38 #include "platform/InstanceCounters.h" | 37 #include "platform/InstanceCounters.h" |
| 39 #include "wtf/PtrUtil.h" | 38 #include "wtf/PtrUtil.h" |
| 40 #include "wtf/StringExtras.h" | 39 #include "wtf/StringExtras.h" |
| 41 #include <memory> | 40 #include <memory> |
| 42 #include <stdlib.h> | 41 #include <stdlib.h> |
| 43 | 42 |
| 44 namespace blink { | 43 namespace blink { |
| 45 | 44 |
| 46 V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) | 45 V8PerContextData::V8PerContextData(v8::Local<v8::Context> context) |
| 47 : m_isolate(context->GetIsolate()), | 46 : m_isolate(context->GetIsolate()), |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 *prototypeObject = prototypeForType(type); | 181 *prototypeObject = prototypeForType(type); |
| 183 DCHECK(!prototypeObject->IsEmpty()); | 182 DCHECK(!prototypeObject->IsEmpty()); |
| 184 return true; | 183 return true; |
| 185 } | 184 } |
| 186 | 185 |
| 187 void V8PerContextData::addCustomElementBinding( | 186 void V8PerContextData::addCustomElementBinding( |
| 188 std::unique_ptr<V0CustomElementBinding> binding) { | 187 std::unique_ptr<V0CustomElementBinding> binding) { |
| 189 m_customElementBindings.push_back(std::move(binding)); | 188 m_customElementBindings.push_back(std::move(binding)); |
| 190 } | 189 } |
| 191 | 190 |
| 192 void V8PerContextData::setModulator(Modulator* modulator) { | 191 void V8PerContextData::addData(const char* key, Data* data) { |
| 193 DCHECK(!m_modulator); | 192 m_dataMap.set(key, data); |
| 194 DCHECK(modulator); | |
| 195 m_modulator = modulator; | |
| 196 } | 193 } |
| 197 | 194 |
| 198 void V8PerContextData::clearModulator() { | 195 void V8PerContextData::clearData(const char* key) { |
| 199 m_modulator = nullptr; | 196 m_dataMap.erase(key); |
| 197 } |
| 198 |
| 199 V8PerContextData::Data* V8PerContextData::getData(const char* key) { |
| 200 return m_dataMap.at(key); |
| 200 } | 201 } |
| 201 | 202 |
| 202 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |