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 30 matching lines...) Expand all Loading... | |
| 41 #include "wtf/Allocator.h" | 41 #include "wtf/Allocator.h" |
| 42 #include "wtf/HashMap.h" | 42 #include "wtf/HashMap.h" |
| 43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
| 44 #include "wtf/text/AtomicString.h" | 44 #include "wtf/text/AtomicString.h" |
| 45 #include "wtf/text/AtomicStringHash.h" | 45 #include "wtf/text/AtomicStringHash.h" |
| 46 #include <memory> | 46 #include <memory> |
| 47 #include <v8.h> | 47 #include <v8.h> |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 class Modulator; | |
| 51 class V8DOMActivityLogger; | 52 class V8DOMActivityLogger; |
| 52 class V8PerContextData; | 53 class V8PerContextData; |
| 53 | 54 |
| 54 enum V8ContextEmbedderDataField { | 55 enum V8ContextEmbedderDataField { |
| 55 v8ContextPerContextDataIndex = | 56 v8ContextPerContextDataIndex = |
| 56 static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink), | 57 static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink), |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 class CORE_EXPORT V8PerContextData final { | 60 class CORE_EXPORT V8PerContextData final { |
| 60 USING_FAST_MALLOC(V8PerContextData); | 61 USING_FAST_MALLOC(V8PerContextData); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 86 | 87 |
| 87 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); | 88 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); |
| 88 | 89 |
| 89 void addCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); | 90 void addCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); |
| 90 | 91 |
| 91 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } | 92 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } |
| 92 void setActivityLogger(V8DOMActivityLogger* activityLogger) { | 93 void setActivityLogger(V8DOMActivityLogger* activityLogger) { |
| 93 m_activityLogger = activityLogger; | 94 m_activityLogger = activityLogger; |
| 94 } | 95 } |
| 95 | 96 |
| 97 Modulator* modulator() const { return m_modulator.get(); } | |
| 98 void setModulator(Modulator*); | |
|
haraken
2017/01/18 06:55:56
Instead of eagerly setting a modulator, can we ins
kouhei (in TOK)
2017/01/18 07:07:10
Yes. This is what we are going to do.
| |
| 99 void clearModulator(); | |
| 100 | |
| 96 private: | 101 private: |
| 97 V8PerContextData(v8::Local<v8::Context>); | 102 V8PerContextData(v8::Local<v8::Context>); |
| 98 | 103 |
| 99 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*); | 104 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*); |
| 100 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); | 105 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); |
| 101 | 106 |
| 102 v8::Isolate* m_isolate; | 107 v8::Isolate* m_isolate; |
| 103 | 108 |
| 104 // For each possible type of wrapper, we keep a boilerplate object. | 109 // For each possible type of wrapper, we keep a boilerplate object. |
| 105 // The boilerplate is used to create additional wrappers of the same type. | 110 // The boilerplate is used to create additional wrappers of the same type. |
| 106 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> | 111 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> |
| 107 WrapperBoilerplateMap; | 112 WrapperBoilerplateMap; |
| 108 WrapperBoilerplateMap m_wrapperBoilerplates; | 113 WrapperBoilerplateMap m_wrapperBoilerplates; |
| 109 | 114 |
| 110 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> | 115 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> |
| 111 ConstructorMap; | 116 ConstructorMap; |
| 112 ConstructorMap m_constructorMap; | 117 ConstructorMap m_constructorMap; |
| 113 | 118 |
| 114 std::unique_ptr<gin::ContextHolder> m_contextHolder; | 119 std::unique_ptr<gin::ContextHolder> m_contextHolder; |
| 115 | 120 |
| 116 ScopedPersistent<v8::Context> m_context; | 121 ScopedPersistent<v8::Context> m_context; |
| 117 ScopedPersistent<v8::Value> m_errorPrototype; | 122 ScopedPersistent<v8::Value> m_errorPrototype; |
| 118 | 123 |
| 119 typedef Vector<std::unique_ptr<V0CustomElementBinding>> | 124 typedef Vector<std::unique_ptr<V0CustomElementBinding>> |
| 120 V0CustomElementBindingList; | 125 V0CustomElementBindingList; |
| 121 V0CustomElementBindingList m_customElementBindings; | 126 V0CustomElementBindingList m_customElementBindings; |
| 122 | 127 |
| 123 // This is owned by a static hash map in V8DOMActivityLogger. | 128 // This is owned by a static hash map in V8DOMActivityLogger. |
| 124 V8DOMActivityLogger* m_activityLogger; | 129 V8DOMActivityLogger* m_activityLogger; |
| 130 | |
| 131 Persistent<Modulator> m_modulator; | |
| 125 }; | 132 }; |
| 126 | 133 |
| 127 } // namespace blink | 134 } // namespace blink |
| 128 | 135 |
| 129 #endif // V8PerContextData_h | 136 #endif // V8PerContextData_h |
| OLD | NEW |