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

Side by Side Diff: Source/bindings/v8/V8PerIsolateData.cpp

Issue 319753004: Enqueue Blink microtasks using V8's C++ API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/bindings/v8/V8PerIsolateData.h ('k') | Source/core/dom/Microtask.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 isolate->AddCallCompletedCallback(&assertV8RecursionScope); 68 isolate->AddCallCompletedCallback(&assertV8RecursionScope);
69 #endif 69 #endif
70 if (isMainThread()) { 70 if (isMainThread()) {
71 mainThreadPerIsolateData = this; 71 mainThreadPerIsolateData = this;
72 PageScriptDebugServer::setMainThreadIsolate(isolate); 72 PageScriptDebugServer::setMainThreadIsolate(isolate);
73 } 73 }
74 } 74 }
75 75
76 V8PerIsolateData::~V8PerIsolateData() 76 V8PerIsolateData::~V8PerIsolateData()
77 { 77 {
78 if (m_blinkInJSScriptState) 78 if (m_scriptRegexpScriptState)
79 m_blinkInJSScriptState->disposePerContextData(); 79 m_scriptRegexpScriptState->disposePerContextData();
80 if (isMainThread()) 80 if (isMainThread())
81 mainThreadPerIsolateData = 0; 81 mainThreadPerIsolateData = 0;
82 } 82 }
83 83
84 v8::Isolate* V8PerIsolateData::mainThreadIsolate() 84 v8::Isolate* V8PerIsolateData::mainThreadIsolate()
85 { 85 {
86 ASSERT(isMainThread()); 86 ASSERT(isMainThread());
87 ASSERT(mainThreadPerIsolateData); 87 ASSERT(mainThreadPerIsolateData);
88 return mainThreadPerIsolateData->isolate(); 88 return mainThreadPerIsolateData->isolate();
89 } 89 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (result != domTemplateMap.end()) 141 if (result != domTemplateMap.end())
142 return result->value.Get(m_isolate); 142 return result->value.Get(m_isolate);
143 return v8::Local<v8::FunctionTemplate>(); 143 return v8::Local<v8::FunctionTemplate>();
144 } 144 }
145 145
146 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct ionTemplate> templ) 146 void V8PerIsolateData::setDOMTemplate(void* domTemplateKey, v8::Handle<v8::Funct ionTemplate> templ)
147 { 147 {
148 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate >(m_isolate, v8::Local<v8::FunctionTemplate>(templ))); 148 currentDOMTemplateMap().add(domTemplateKey, v8::Eternal<v8::FunctionTemplate >(m_isolate, v8::Local<v8::FunctionTemplate>(templ)));
149 } 149 }
150 150
151 v8::Local<v8::Context> V8PerIsolateData::ensureDomInJSContext() 151 v8::Local<v8::Context> V8PerIsolateData::ensureScriptRegexpContext()
152 { 152 {
153 if (!m_blinkInJSScriptState) { 153 if (!m_scriptRegexpScriptState) {
154 v8::Local<v8::Context> context(v8::Context::New(m_isolate)); 154 v8::Local<v8::Context> context(v8::Context::New(m_isolate));
155 if (!context.IsEmpty()) 155 m_scriptRegexpScriptState = ScriptState::create(context, DOMWrapperWorld ::create());
156 m_blinkInJSScriptState = ScriptState::create(context, DOMWrapperWorl d::create());
157 } 156 }
158 return m_blinkInJSScriptState ? m_blinkInJSScriptState->context() : v8::Loca l<v8::Context>(); 157 return m_scriptRegexpScriptState->context();
159 } 158 }
160 159
161 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V alue> value) 160 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V alue> value)
162 { 161 {
163 return hasInstance(info, value, m_domTemplateMapForMainWorld) 162 return hasInstance(info, value, m_domTemplateMapForMainWorld)
164 || hasInstance(info, value, m_domTemplateMapForNonMainWorld); 163 || hasInstance(info, value, m_domTemplateMapForNonMainWorld);
165 } 164 }
166 165
167 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V alue> value, DOMTemplateMap& domTemplateMap) 166 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V alue> value, DOMTemplateMap& domTemplateMap)
168 { 167 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 210 }
212 211
213 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate() 212 v8::Handle<v8::FunctionTemplate> V8PerIsolateData::toStringTemplate()
214 { 213 {
215 if (m_toStringTemplate.isEmpty()) 214 if (m_toStringTemplate.isEmpty())
216 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(m_isolate, c onstructorOfToString)); 215 m_toStringTemplate.set(m_isolate, v8::FunctionTemplate::New(m_isolate, c onstructorOfToString));
217 return m_toStringTemplate.newLocal(m_isolate); 216 return m_toStringTemplate.newLocal(m_isolate);
218 } 217 }
219 218
220 } // namespace WebCore 219 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8PerIsolateData.h ('k') | Source/core/dom/Microtask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698