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(); } | |
dominicc (has gone to gerrit)
2017/01/11 03:23:47
Hmm, interesting. Why not have ExecutionContext::m
kouhei (in TOK)
2017/01/17 05:26:13
Discussed offline. We need something in LocalWindo
| |
98 void setModulator(Modulator*); | |
99 | |
96 private: | 100 private: |
97 V8PerContextData(v8::Local<v8::Context>); | 101 V8PerContextData(v8::Local<v8::Context>); |
98 | 102 |
99 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*); | 103 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*); |
100 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); | 104 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); |
101 | 105 |
102 v8::Isolate* m_isolate; | 106 v8::Isolate* m_isolate; |
103 | 107 |
104 // For each possible type of wrapper, we keep a boilerplate object. | 108 // For each possible type of wrapper, we keep a boilerplate object. |
105 // The boilerplate is used to create additional wrappers of the same type. | 109 // The boilerplate is used to create additional wrappers of the same type. |
106 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> | 110 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> |
107 WrapperBoilerplateMap; | 111 WrapperBoilerplateMap; |
108 WrapperBoilerplateMap m_wrapperBoilerplates; | 112 WrapperBoilerplateMap m_wrapperBoilerplates; |
109 | 113 |
110 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> | 114 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> |
111 ConstructorMap; | 115 ConstructorMap; |
112 ConstructorMap m_constructorMap; | 116 ConstructorMap m_constructorMap; |
113 | 117 |
114 std::unique_ptr<gin::ContextHolder> m_contextHolder; | 118 std::unique_ptr<gin::ContextHolder> m_contextHolder; |
115 | 119 |
116 ScopedPersistent<v8::Context> m_context; | 120 ScopedPersistent<v8::Context> m_context; |
117 ScopedPersistent<v8::Value> m_errorPrototype; | 121 ScopedPersistent<v8::Value> m_errorPrototype; |
118 | 122 |
119 typedef Vector<std::unique_ptr<V0CustomElementBinding>> | 123 typedef Vector<std::unique_ptr<V0CustomElementBinding>> |
120 V0CustomElementBindingList; | 124 V0CustomElementBindingList; |
121 V0CustomElementBindingList m_customElementBindings; | 125 V0CustomElementBindingList m_customElementBindings; |
122 | 126 |
123 // This is owned by a static hash map in V8DOMActivityLogger. | 127 // This is owned by a static hash map in V8DOMActivityLogger. |
124 V8DOMActivityLogger* m_activityLogger; | 128 V8DOMActivityLogger* m_activityLogger; |
129 | |
130 Persistent<Modulator> m_modulator; | |
haraken
2017/01/11 02:31:28
ScopedPersistent?
kouhei (in TOK)
2017/01/17 05:26:13
Modulator is an Oilpan obj.
| |
125 }; | 131 }; |
126 | 132 |
127 } // namespace blink | 133 } // namespace blink |
128 | 134 |
129 #endif // V8PerContextData_h | 135 #endif // V8PerContextData_h |
OLD | NEW |