Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1009)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: ModuleScriptLoaderTest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ScriptModuleResolver;
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
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 ScriptModuleResolver* moduleResolver() const { return m_moduleResolver; }
98 void setModuleResolver(ScriptModuleResolver* moduleResolver) {
99 m_moduleResolver = moduleResolver;
100 }
101
96 private: 102 private:
97 V8PerContextData(v8::Local<v8::Context>); 103 V8PerContextData(v8::Local<v8::Context>);
98 104
99 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*); 105 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*);
100 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); 106 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*);
101 107
102 v8::Isolate* m_isolate; 108 v8::Isolate* m_isolate;
103 109
104 // For each possible type of wrapper, we keep a boilerplate object. 110 // For each possible type of wrapper, we keep a boilerplate object.
105 // The boilerplate is used to create additional wrappers of the same type. 111 // The boilerplate is used to create additional wrappers of the same type.
106 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> 112 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak>
107 WrapperBoilerplateMap; 113 WrapperBoilerplateMap;
108 WrapperBoilerplateMap m_wrapperBoilerplates; 114 WrapperBoilerplateMap m_wrapperBoilerplates;
109 115
110 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> 116 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak>
111 ConstructorMap; 117 ConstructorMap;
112 ConstructorMap m_constructorMap; 118 ConstructorMap m_constructorMap;
113 119
114 std::unique_ptr<gin::ContextHolder> m_contextHolder; 120 std::unique_ptr<gin::ContextHolder> m_contextHolder;
115 121
116 ScopedPersistent<v8::Context> m_context; 122 ScopedPersistent<v8::Context> m_context;
117 ScopedPersistent<v8::Value> m_errorPrototype; 123 ScopedPersistent<v8::Value> m_errorPrototype;
118 124
119 typedef Vector<std::unique_ptr<V0CustomElementBinding>> 125 typedef Vector<std::unique_ptr<V0CustomElementBinding>>
120 V0CustomElementBindingList; 126 V0CustomElementBindingList;
121 V0CustomElementBindingList m_customElementBindings; 127 V0CustomElementBindingList m_customElementBindings;
122 128
123 // This is owned by a static hash map in V8DOMActivityLogger. 129 // This is owned by a static hash map in V8DOMActivityLogger.
124 V8DOMActivityLogger* m_activityLogger; 130 V8DOMActivityLogger* m_activityLogger;
131
132 ScriptModuleResolver* m_moduleResolver;
125 }; 133 };
126 134
127 } // namespace blink 135 } // namespace blink
128 136
129 #endif // V8PerContextData_h 137 #endif // V8PerContextData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698