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

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

Issue 1067763002: bindings: Use Maybe version of Get in bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 struct V8NPObject; 53 struct V8NPObject;
54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; 54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector;
55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; 55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap;
56 56
57 enum V8ContextEmbedderDataField { 57 enum V8ContextEmbedderDataField {
58 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd ex + gin::kEmbedderBlink), 58 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd ex + gin::kEmbedderBlink),
59 }; 59 };
60 60
61 class CORE_EXPORT V8PerContextData final { 61 class CORE_EXPORT V8PerContextData final {
62 public: 62 public:
63 static PassOwnPtr<V8PerContextData> create(v8::Handle<v8::Context>); 63 static PassOwnPtr<V8PerContextData> create(v8::Local<v8::Context>);
64 64
65 static V8PerContextData* from(v8::Handle<v8::Context>); 65 static V8PerContextData* from(v8::Local<v8::Context>);
66 66
67 ~V8PerContextData(); 67 ~V8PerContextData();
68 68
69 v8::Local<v8::Context> context() { return m_context.newLocal(m_isolate); } 69 v8::Local<v8::Context> context() { return m_context.newLocal(m_isolate); }
70 70
71 // To create JS Wrapper objects, we create a cache of a 'boiler plate' 71 // To create JS Wrapper objects, we create a cache of a 'boiler plate'
72 // object, and then simply Clone that object each time we need a new one. 72 // object, and then simply Clone that object each time we need a new one.
73 // This is faster than going through the full object creation process. 73 // This is faster than going through the full object creation process.
74 v8::Local<v8::Object> createWrapperFromCache(const WrapperTypeInfo* type) 74 v8::Local<v8::Object> createWrapperFromCache(const WrapperTypeInfo* type)
75 { 75 {
(...skipping 13 matching lines...) Expand all
89 89
90 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem entBinding>); 90 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem entBinding>);
91 91
92 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } 92 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; }
93 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg er = activityLogger; } 93 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg er = activityLogger; }
94 94
95 v8::Handle<v8::Value> compiledPrivateScript(String); 95 v8::Handle<v8::Value> compiledPrivateScript(String);
96 void setCompiledPrivateScript(String, v8::Handle<v8::Value>); 96 void setCompiledPrivateScript(String, v8::Handle<v8::Value>);
97 97
98 private: 98 private:
99 V8PerContextData(v8::Handle<v8::Context>); 99 V8PerContextData(v8::Local<v8::Context>);
100 100
101 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*) ; 101 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*) ;
102 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); 102 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*);
103 103
104 v8::Isolate* m_isolate; 104 v8::Isolate* m_isolate;
105 105
106 // For each possible type of wrapper, we keep a boilerplate object. 106 // For each possible type of wrapper, we keep a boilerplate object.
107 // The boilerplate is used to create additional wrappers of the same type. 107 // The boilerplate is used to create additional wrappers of the same type.
108 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Object, false> Wrap perBoilerplateMap; 108 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Object, false> Wrap perBoilerplateMap;
109 WrapperBoilerplateMap m_wrapperBoilerplates; 109 WrapperBoilerplateMap m_wrapperBoilerplates;
(...skipping 13 matching lines...) Expand all
123 123
124 // This is owned by a static hash map in V8DOMActivityLogger. 124 // This is owned by a static hash map in V8DOMActivityLogger.
125 V8DOMActivityLogger* m_activityLogger; 125 V8DOMActivityLogger* m_activityLogger;
126 126
127 V8PersistentValueMap<String, v8::Value, false> m_compiledPrivateScript; 127 V8PersistentValueMap<String, v8::Value, false> m_compiledPrivateScript;
128 }; 128 };
129 129
130 } // namespace blink 130 } // namespace blink
131 131
132 #endif // V8PerContextData_h 132 #endif // V8PerContextData_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8NodeFilterCondition.cpp ('k') | Source/bindings/core/v8/V8PerContextData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698