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

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

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 #include "wtf/text/AtomicString.h" 45 #include "wtf/text/AtomicString.h"
46 #include "wtf/text/AtomicStringHash.h" 46 #include "wtf/text/AtomicStringHash.h"
47 #include <v8.h> 47 #include <v8.h>
48 48
49 namespace blink { 49 namespace blink {
50 50
51 class CustomElementDefinition; 51 class CustomElementDefinition;
52 class V8DOMActivityLogger; 52 class V8DOMActivityLogger;
53 class V8PerContextData; 53 class V8PerContextData;
54 struct V8NPObject;
55 typedef WTF::Vector<V8NPObject*> V8NPObjectVector;
56 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap;
57 54
58 enum V8ContextEmbedderDataField { 55 enum V8ContextEmbedderDataField {
59 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd ex + gin::kEmbedderBlink), 56 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd ex + gin::kEmbedderBlink),
60 }; 57 };
61 58
62 class CORE_EXPORT V8PerContextData final { 59 class CORE_EXPORT V8PerContextData final {
63 USING_FAST_MALLOC(V8PerContextData); 60 USING_FAST_MALLOC(V8PerContextData);
64 WTF_MAKE_NONCOPYABLE(V8PerContextData); 61 WTF_MAKE_NONCOPYABLE(V8PerContextData);
65 public: 62 public:
66 static PassOwnPtr<V8PerContextData> create(v8::Local<v8::Context>); 63 static PassOwnPtr<V8PerContextData> create(v8::Local<v8::Context>);
(...skipping 14 matching lines...) Expand all
81 } 78 }
82 79
83 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type) 80 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type)
84 { 81 {
85 v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type); 82 v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type);
86 return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTy peSlowCase(type); 83 return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTy peSlowCase(type);
87 } 84 }
88 85
89 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); 86 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*);
90 87
91 V8NPObjectMap* getV8NPObjectMap() { return &m_v8NPObjectMap; }
92
93 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem entBinding>); 88 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem entBinding>);
94 89
95 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } 90 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; }
96 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg er = activityLogger; } 91 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg er = activityLogger; }
97 92
98 v8::Local<v8::Value> compiledPrivateScript(String); 93 v8::Local<v8::Value> compiledPrivateScript(String);
99 void setCompiledPrivateScript(String, v8::Local<v8::Value>); 94 void setCompiledPrivateScript(String, v8::Local<v8::Value>);
100 95
101 private: 96 private:
102 V8PerContextData(v8::Local<v8::Context>); 97 V8PerContextData(v8::Local<v8::Context>);
103 98
104 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*) ; 99 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*) ;
105 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); 100 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*);
106 101
107 v8::Isolate* m_isolate; 102 v8::Isolate* m_isolate;
108 103
109 // For each possible type of wrapper, we keep a boilerplate object. 104 // For each possible type of wrapper, we keep a boilerplate object.
110 // The boilerplate is used to create additional wrappers of the same type. 105 // The boilerplate is used to create additional wrappers of the same type.
111 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> W rapperBoilerplateMap; 106 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> W rapperBoilerplateMap;
112 WrapperBoilerplateMap m_wrapperBoilerplates; 107 WrapperBoilerplateMap m_wrapperBoilerplates;
113 108
114 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> ConstructorMap; 109 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> ConstructorMap;
115 ConstructorMap m_constructorMap; 110 ConstructorMap m_constructorMap;
116 111
117 V8NPObjectMap m_v8NPObjectMap;
118
119 OwnPtr<gin::ContextHolder> m_contextHolder; 112 OwnPtr<gin::ContextHolder> m_contextHolder;
120 113
121 ScopedPersistent<v8::Context> m_context; 114 ScopedPersistent<v8::Context> m_context;
122 ScopedPersistent<v8::Value> m_errorPrototype; 115 ScopedPersistent<v8::Value> m_errorPrototype;
123 116
124 typedef Vector<OwnPtr<CustomElementBinding>> CustomElementBindingList; 117 typedef Vector<OwnPtr<CustomElementBinding>> CustomElementBindingList;
125 CustomElementBindingList m_customElementBindings; 118 CustomElementBindingList m_customElementBindings;
126 119
127 // This is owned by a static hash map in V8DOMActivityLogger. 120 // This is owned by a static hash map in V8DOMActivityLogger.
128 V8DOMActivityLogger* m_activityLogger; 121 V8DOMActivityLogger* m_activityLogger;
129 122
130 V8GlobalValueMap<String, v8::Value, v8::kNotWeak> m_compiledPrivateScript; 123 V8GlobalValueMap<String, v8::Value, v8::kNotWeak> m_compiledPrivateScript;
131 }; 124 };
132 125
133 } // namespace blink 126 } // namespace blink
134 127
135 #endif // V8PerContextData_h 128 #endif // V8PerContextData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698