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

Side by Side Diff: sky/engine/bindings/core/v8/V8PerIsolateData.h

Issue 922053002: Remove unused V8 integration code in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef SKY_ENGINE_BINDINGS_CORE_V8_V8PERISOLATEDATA_H_
27 #define SKY_ENGINE_BINDINGS_CORE_V8_V8PERISOLATEDATA_H_
28
29 #include "gin/public/gin_embedders.h"
30 #include "gin/public/isolate_holder.h"
31 #include "sky/engine/bindings/core/v8/ScopedPersistent.h"
32 #include "sky/engine/bindings/core/v8/ScriptState.h"
33 #include "sky/engine/bindings/core/v8/V8HiddenValue.h"
34 #include "sky/engine/bindings/core/v8/WrapperTypeInfo.h"
35 #include "sky/engine/wtf/Forward.h"
36 #include "sky/engine/wtf/HashMap.h"
37 #include "sky/engine/wtf/OwnPtr.h"
38 #include "sky/engine/wtf/Vector.h"
39 #include "v8/include/v8.h"
40
41 namespace blink {
42
43 class DOMDataStore;
44 class GCEventData;
45 class StringCache;
46 struct WrapperTypeInfo;
47
48 class ExternalStringVisitor;
49
50 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList;
51
52 class V8PerIsolateData {
53 public:
54 static v8::Isolate* initialize();
55 static V8PerIsolateData* from(v8::Isolate* isolate)
56 {
57 ASSERT(isolate);
58 ASSERT(isolate->GetData(gin::kEmbedderBlink));
59 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli nk));
60 }
61 static void dispose(v8::Isolate*);
62 static v8::Isolate* mainThreadIsolate();
63
64 v8::Isolate* isolate() { return m_isolateHolder->isolate(); }
65
66 v8::Handle<v8::FunctionTemplate> toStringTemplate();
67
68 StringCache* stringCache() { return m_stringCache.get(); }
69
70 v8::Persistent<v8::Value>& ensureLiveRoot();
71
72 int recursionLevel() const { return m_recursionLevel; }
73 int incrementRecursionLevel() { return ++m_recursionLevel; }
74 int decrementRecursionLevel() { return --m_recursionLevel; }
75 bool isHandlingRecursionLevelError() const { return m_isHandlingRecursionLev elError; }
76 void setIsHandlingRecursionLevelError(bool value) { m_isHandlingRecursionLev elError = value; }
77
78 bool performingMicrotaskCheckpoint() const { return m_performingMicrotaskChe ckpoint; }
79 void setPerformingMicrotaskCheckpoint(bool performingMicrotaskCheckpoint) { m_performingMicrotaskCheckpoint = performingMicrotaskCheckpoint; }
80
81 #if ENABLE(ASSERT)
82 int internalScriptRecursionLevel() const { return m_internalScriptRecursionL evel; }
83 int incrementInternalScriptRecursionLevel() { return ++m_internalScriptRecur sionLevel; }
84 int decrementInternalScriptRecursionLevel() { return --m_internalScriptRecur sionLevel; }
85 #endif
86
87 GCEventData* gcEventData() { return m_gcEventData.get(); }
88 V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); }
89
90 v8::Handle<v8::FunctionTemplate> domTemplate(void* domTemplateKey, v8::Funct ionCallback = 0, v8::Handle<v8::Value> data = v8::Handle<v8::Value>(), v8::Handl e<v8::Signature> = v8::Handle<v8::Signature>(), int length = 0);
91 v8::Handle<v8::FunctionTemplate> existingDOMTemplate(void* domTemplateKey);
92 void setDOMTemplate(void* domTemplateKey, v8::Handle<v8::FunctionTemplate>);
93
94 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>);
95 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Handle<v8::Value>);
96
97 v8::Local<v8::Context> ensureScriptRegexpContext();
98
99 const char* previousSamplingState() const { return m_previousSamplingState; }
100 void setPreviousSamplingState(const char* name) { m_previousSamplingState = name; }
101
102 private:
103 V8PerIsolateData();
104 ~V8PerIsolateData();
105
106 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate> > DOMTemplate Map;
107 DOMTemplateMap& currentDOMTemplateMap();
108 bool hasInstance(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateM ap&);
109 v8::Handle<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Handle<v8::Value>, DOMTemplateMap&);
110
111 OwnPtr<gin::IsolateHolder> m_isolateHolder;
112 DOMTemplateMap m_domTemplateMapForMainWorld;
113 DOMTemplateMap m_domTemplateMapForNonMainWorld;
114 ScopedPersistent<v8::FunctionTemplate> m_toStringTemplate;
115 OwnPtr<StringCache> m_stringCache;
116 OwnPtr<V8HiddenValue> m_hiddenValue;
117 ScopedPersistent<v8::Value> m_liveRoot;
118 RefPtr<ScriptState> m_scriptRegexpScriptState;
119
120 const char* m_previousSamplingState;
121
122 bool m_constructorMode;
123 friend class ConstructorMode;
124
125 int m_recursionLevel;
126 bool m_isHandlingRecursionLevelError;
127
128 #if ENABLE(ASSERT)
129 int m_internalScriptRecursionLevel;
130 #endif
131 OwnPtr<GCEventData> m_gcEventData;
132 bool m_performingMicrotaskCheckpoint;
133 };
134
135 } // namespace blink
136
137 #endif // SKY_ENGINE_BINDINGS_CORE_V8_V8PERISOLATEDATA_H_
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/V8PerContextData.cpp ('k') | sky/engine/bindings/core/v8/V8PerIsolateData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698